Commits

Anonymous committed bf6781b

don't forget streaming from Document object. Now all attachements could
be streamed.

Comments (0)

Files changed (2)

couchdbkit/client.py

 
     def put_attachment(self, doc, content, name=None, content_type=None, 
         content_length=None):
-        """ Add attachement to a document.
+        """ Add attachement to a document. All attachments are streamed.
 
         @param doc: dict, document object
         @param content: string or :obj:`File` object.

couchdbkit/schema/base.py

             raise TypeError("doc database required to save document")
         return self.__class__._db.delete_attachment(self, name)
 
-    def fetch_attachment(self, name):
+    def fetch_attachment(self, name, stream=False, stream_size=16384):
         """ get attachment in a adocument
         
         @param name: name of attachment default: default result
-
+        @param stream: boolean, response return a ResponseStream object
+        @param stream_size: int, size in bytes of response stream block
+        
         @return: str or unicode, attachment
         """
         if not hasattr(self, '_db'):
             raise TypeError("doc database required to save document")
-        return self.__class__._db.fetch_attachment(self, name)
+        return self.__class__._db.fetch_attachment(self, name, stream=stream,
+            stream_size=stream_size)
         
         
 class QueryMixin(object):