[Inteproxy-commits] r329 - in branches/streaming: . inteproxy

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 3 17:07:03 CET 2012


Author: teichmann
Date: 2012-01-03 17:07:03 +0100 (Tue, 03 Jan 2012)
New Revision: 329

Modified:
   branches/streaming/ChangeLog
   branches/streaming/inteproxy/chunkedwriter.py
Log:
Added doc strings to chunk writer.

Modified: branches/streaming/ChangeLog
===================================================================
--- branches/streaming/ChangeLog	2012-01-02 09:34:52 UTC (rev 328)
+++ branches/streaming/ChangeLog	2012-01-03 16:07:03 UTC (rev 329)
@@ -1,3 +1,7 @@
+2012-01-03	Sascha L. Teichmann	<sascha.teichmann at intevation.de>
+
+	* inteproxy/chunkedwriter.py: Added doc strings.
+
 2012-01-02	Sascha L. Teichmann	<sascha.teichmann at intevation.de>
 
 	* inteproxy/proxycore.py(wrap_read_write_debug): Forgot self.

Modified: branches/streaming/inteproxy/chunkedwriter.py
===================================================================
--- branches/streaming/inteproxy/chunkedwriter.py	2012-01-02 09:34:52 UTC (rev 328)
+++ branches/streaming/inteproxy/chunkedwriter.py	2012-01-03 16:07:03 UTC (rev 329)
@@ -5,13 +5,18 @@
 # This program is free software under the GPL (>=v2)
 # Read the file COPYING coming with the software for details
 
-"""TODO: Document me!"""
+"""RFC 2616 Sec. 3.6 compatible chunked transfer encoding"""
 
 class ChunkedTransferEncodingWriter(object):
-    """TODO: Document me!"""
+    """A class to write byte data in chunks in a RFC 2616 Sec. 3.6 compatible
+    manner to an output.
 
+    The chunk size and the method used to write out the data are
+    to be given at construction time.
+    """
+
     def __init__(self, write, block_size=4096):
-        """TODO: Document me!"""
+        """Initialize the writer with a write out method and a chunk size."""
 
         self.write = write
         self.block_size = block_size
@@ -19,7 +24,11 @@
         self.size = 0
 
     def append(self, block):
-        """TODO: Document me!"""
+        """Add a byte array to the output. The data is chunked according
+        to the specified size. If the length of the given data is smaller
+        than the chunk size the data is hold back until subsequent calls
+        to append() add enough bytes to flush it in the right chunk size.
+        """
 
         write = self.write
         block_size = self.block_size
@@ -47,7 +56,9 @@
             block = block[head_size:]
 
     def finish(self):
-        """TODO: Document me!"""
+        """Flushes the remaining data (if any) to the output and
+        signals the end of stream by sending a zero-sized chunk.
+        """
 
         write = self.write
         if self.size:



More information about the Inteproxy-commits mailing list