From: Brian Warner Date: Tue, 3 Jun 2008 07:01:15 +0000 (-0700) Subject: move FileTooLargeError out to a common location X-Git-Tag: allmydata-tahoe-1.1.0~55 X-Git-Url: https://git.rkrishnan.org/listings/pb1client.py?a=commitdiff_plain;h=5289064dcf05f4dfd3dfd793192799318dbba231;p=tahoe-lafs%2Ftahoe-lafs.git move FileTooLargeError out to a common location --- diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index 5bcb1c74..8dac6fb6 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -1867,3 +1867,8 @@ class RIKeyGenerator(RemoteInterface): @return: tuple(verifying_key, signing_key) """ return TupleOf(str, str) + + +class FileTooLargeError(Exception): + pass + diff --git a/src/allmydata/storage.py b/src/allmydata/storage.py index 44316962..5687aadf 100644 --- a/src/allmydata/storage.py +++ b/src/allmydata/storage.py @@ -9,7 +9,7 @@ from twisted.internet import defer from zope.interface import implements from allmydata.interfaces import RIStorageServer, RIBucketWriter, \ RIBucketReader, IStorageBucketWriter, IStorageBucketReader, HASH_SIZE, \ - BadWriteEnablerError, IStatsProducer + BadWriteEnablerError, IStatsProducer, FileTooLargeError from allmydata.util import base32, fileutil, idlib, mathutil, log from allmydata.util.assertutil import precondition, _assert import allmydata # for __version__ @@ -1071,9 +1071,6 @@ def allocated_size(data_size, num_segments, num_share_hashes, uri_extension_starts_at = wbp._offsets['uri_extension'] return uri_extension_starts_at + 4 + uri_extension_size -class FileTooLargeError(Exception): - pass - class WriteBucketProxy: implements(IStorageBucketWriter) def __init__(self, rref, data_size, segment_size, num_segments, diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py index e0f2c93d..7dd7e008 100644 --- a/src/allmydata/test/test_upload.py +++ b/src/allmydata/test/test_upload.py @@ -6,8 +6,8 @@ from twisted.python import log from twisted.internet import defer from cStringIO import StringIO -from allmydata import upload, encode, uri, storage -from allmydata.interfaces import IFileURI +from allmydata import upload, encode, uri +from allmydata.interfaces import IFileURI, FileTooLargeError from allmydata.util.assertutil import precondition from allmydata.util.deferredutil import DeferredListShouldSucceed from allmydata.util.testutil import ShouldFailMixin @@ -240,12 +240,12 @@ class GoodServer(unittest.TestCase, ShouldFailMixin): k = 3; happy = 7; n = 10 self.set_encoding_parameters(k, happy, n) data1 = GiganticUploadable(k*4*1024*1024*1024) - d = self.shouldFail(storage.FileTooLargeError, "test_too_large-data1", + d = self.shouldFail(FileTooLargeError, "test_too_large-data1", "This file is too large to be uploaded (data_size)", self.u.upload, data1) data2 = GiganticUploadable(k*4*1024*1024*1024-3) d.addCallback(lambda res: - self.shouldFail(storage.FileTooLargeError, + self.shouldFail(FileTooLargeError, "test_too_large-data2", "This file is too large to be uploaded (offsets)", self.u.upload, data2))