]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Encoder.__repr__: mention the file being encoded
authorBrian Warner <warner@allmydata.com>
Fri, 10 Aug 2007 01:26:56 +0000 (18:26 -0700)
committerBrian Warner <warner@allmydata.com>
Fri, 10 Aug 2007 01:26:56 +0000 (18:26 -0700)
src/allmydata/encode.py

index b79ef370c6e80a53b2ec09359b782c89c31d2eb9..04f566118cde525036cee6ce462a2a585eb4d584 100644 (file)
@@ -6,7 +6,7 @@ from twisted.python import log
 from foolscap import eventual
 from allmydata import uri
 from allmydata.hashtree import HashTree
-from allmydata.util import mathutil, hashutil
+from allmydata.util import mathutil, hashutil, idlib
 from allmydata.util.assertutil import _assert
 from allmydata.codec import CRSEncoder
 from allmydata.interfaces import IEncoder, IStorageBucketWriter, \
@@ -90,6 +90,11 @@ class Encoder(object):
         self.uri_extension_data = {}
         self._codec = None
 
+    def __repr__(self):
+        if hasattr(self, "_storage_index"):
+            return "<Encoder for %s>" % idlib.b2a(self._storage_index)[:6]
+        return "<Encoder for unknown storage index>"
+
     def set_size(self, size):
         assert not self._codec
         self.file_size = size