From: Brian Warner <warner@allmydata.com>
Date: Fri, 10 Aug 2007 01:26:56 +0000 (-0700)
Subject: Encoder.__repr__: mention the file being encoded
X-Git-Tag: allmydata-tahoe-0.5.0~85
X-Git-Url: https://git.rkrishnan.org/%5B/frontends/%22news.html/...?a=commitdiff_plain;h=08ee80176a0ef44101aa4056aeb697b53a0965ea;p=tahoe-lafs%2Ftahoe-lafs.git

Encoder.__repr__: mention the file being encoded
---

diff --git a/src/allmydata/encode.py b/src/allmydata/encode.py
index b79ef370..04f56611 100644
--- a/src/allmydata/encode.py
+++ b/src/allmydata/encode.py
@@ -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