~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Martin Pool
  • Date: 2005-09-22 00:19:45 UTC
  • Revision ID: mbp@sourcefrog.net-20050922001945-04934f479aab6675
- more refactoring of check code

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    def __init__(self, basedir):
69
69
        self._basedir = basedir
70
70
 
71
 
    def _path(self, id):
72
 
        if '\\' in id or '/' in id:
73
 
            raise ValueError("invalid store id %r" % id)
74
 
        return os.path.join(self._basedir, id)
 
71
    def _path(self, entry_id):
 
72
        if not isinstance(entry_id, basestring):
 
73
            raise TypeError(type(entry_id))
 
74
        if '\\' in entry_id or '/' in entry_id:
 
75
            raise ValueError("invalid store id %r" % entry_id)
 
76
        return os.path.join(self._basedir, entry_id)
75
77
 
76
78
    def __repr__(self):
77
79
        return "%s(%r)" % (self.__class__.__name__, self._basedir)
182
184
        return (os.access(p, os.R_OK)
183
185
                or os.access(p + '.gz', os.R_OK))
184
186
 
185
 
    # TODO: Guard against the same thing being stored twice, compressed and uncompresse
 
187
    # TODO: Guard against the same thing being stored twice,
 
188
    # compressed and uncompressed
186
189
 
187
190
    def __iter__(self):
188
191
        for f in os.listdir(self._basedir):