]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
consolidate multiple definitions of NotEnoughPeersError
authorBrian Warner <warner@allmydata.com>
Fri, 8 Jun 2007 05:20:55 +0000 (22:20 -0700)
committerBrian Warner <warner@allmydata.com>
Fri, 8 Jun 2007 05:20:55 +0000 (22:20 -0700)
src/allmydata/download.py
src/allmydata/test/test_upload.py
src/allmydata/upload.py

index ebbce16935453554a5381a655afebb25d4a9d4f9..859f9bfcade547de6eb493942a0988f00aaf5772 100644 (file)
@@ -11,9 +11,7 @@ from allmydata import codec, hashtree
 from allmydata.Crypto.Cipher import AES
 from allmydata.uri import unpack_uri
 from allmydata.interfaces import IDownloadTarget, IDownloader
-
-class NotEnoughPeersError(Exception):
-    pass
+from allmydata.encode import NotEnoughPeersError
 
 class HaveAllPeersError(Exception):
     # we use this to jump out of the loop
index d5b20c1c5f1b72a4a8ea5cc7490740500ce1e0c3..cf6017a0b11f3ea9ef4c9a3fdc0eafb7f4829088 100644 (file)
@@ -3,7 +3,7 @@ from twisted.trial import unittest
 from twisted.python.failure import Failure
 from cStringIO import StringIO
 
-from allmydata import upload
+from allmydata import upload, encode
 from allmydata.uri import unpack_uri
 
 from test_encode import FakePeer
@@ -63,7 +63,7 @@ class FullServer(unittest.TestCase):
         self.u.parent = self.node
 
     def _should_fail(self, f):
-        self.failUnless(isinstance(f, Failure) and f.check(upload.NotEnoughPeersError))
+        self.failUnless(isinstance(f, Failure) and f.check(encode.NotEnoughPeersError))
 
     def testData(self):
         data = "This is some data to upload"
index 48b03f5410da0edfd5386b910b3666c517a0ea2b..4314c3af25e9c78ba1269bfd946a621902eb4cce 100644 (file)
@@ -13,9 +13,6 @@ from allmydata.Crypto.Cipher import AES
 from cStringIO import StringIO
 import collections, random
 
-class NotEnoughPeersError(Exception):
-    pass
-
 class HaveAllPeersError(Exception):
     # we use this to jump out of the loop
     pass
@@ -146,7 +143,7 @@ class FileUploader:
                 # But we allocated places for enough shares.
                 log.msg("%s._locate_all_shareholders() But we allocated places for enough shares.")
                 return self.used_peers
-            raise NotEnoughPeersError
+            raise encode.NotEnoughPeersError
         # we need to keep trying
         return self._locate_more_shareholders()