~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/compressed_text.py

  • Committer: Robert Collins
  • Date: 2005-10-16 08:13:23 UTC
  • mto: This revision was merged to the branch mainline in revision 1459.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051016081323-8393c2878dc4dc9e
convert all users of __getitem__ into TransportStores to use .get instead

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
    Entries can be retrieved as files, which may then be read.
54
54
 
55
55
    >>> st.add(StringIO('goodbye'), '123123')
56
 
    >>> st['123123'].read()
 
56
    >>> st.get('123123').read()
57
57
    'goodbye'
58
58
    """
59
59
 
134
134
    def __len__(self):
135
135
        return len(list(self._iter_relpath()))
136
136
 
137
 
    def __getitem__(self, fileid):
 
137
    def get(self, fileid):
138
138
        """Returns a file reading from a particular entry."""
139
 
        f = super(CompressedTextStore, self).__getitem__(fileid)
 
139
        f = super(CompressedTextStore, self).get(fileid)
140
140
        # gzip.GzipFile.read() requires a tell() function
141
141
        # but some transports return objects that cannot seek
142
142
        # so buffer them in a StringIO instead