From: Brian Warner <warner@allmydata.com>
Date: Tue, 15 Jan 2008 04:17:32 +0000 (-0700)
Subject: upload: pass options through to the encoder
X-Git-Url: https://git.rkrishnan.org/simplejson/components/frontends/?a=commitdiff_plain;h=e65967da49a8232c7d684acfc2768cc03ff04743;p=tahoe-lafs%2Ftahoe-lafs.git

upload: pass options through to the encoder
---

diff --git a/src/allmydata/client.py b/src/allmydata/client.py
index 1d7958ab..50ed9a05 100644
--- a/src/allmydata/client.py
+++ b/src/allmydata/client.py
@@ -253,7 +253,7 @@ class Client(node.Node, Referenceable, testutil.PollMixin):
         d.addCallback(lambda res: n)
         return d
 
-    def upload(self, uploadable):
+    def upload(self, uploadable, options={}):
         uploader = self.getServiceNamed("uploader")
-        return uploader.upload(uploadable)
+        return uploader.upload(uploadable, options)
 
diff --git a/src/allmydata/upload.py b/src/allmydata/upload.py
index 01877cc8..a0ef6af7 100644
--- a/src/allmydata/upload.py
+++ b/src/allmydata/upload.py
@@ -311,8 +311,9 @@ class EncryptAnUploadable:
     IEncryptedUploadable."""
     implements(IEncryptedUploadable)
 
-    def __init__(self, original):
+    def __init__(self, original, options={}):
         self.original = original
+        self._options = options
         self._encryptor = None
         self._plaintext_hasher = plaintext_hasher()
         self._plaintext_segment_hasher = None
@@ -586,7 +587,7 @@ class AssistedUploader:
 
     def start(self, uploadable):
         u = IUploadable(uploadable)
-        eu = IEncryptedUploadable(EncryptAnUploadable(u))
+        eu = IEncryptedUploadable(EncryptAnUploadable(u, self._options))
         self._encuploadable = eu
         d = eu.get_size()
         d.addCallback(self._got_size)