[Checkins] SVN: z3c.extfile/trunk/ bugfix see CHANGES.txt

Bernd Dorn bernd.dorn at lovelysystems.com
Mon Jul 14 09:14:08 EDT 2008


Log message for revision 88345:
  bugfix see CHANGES.txt

Changed:
  U   z3c.extfile/trunk/CHANGES.txt
  U   z3c.extfile/trunk/setup.py
  U   z3c.extfile/trunk/src/z3c/extfile/filter.py
  U   z3c.extfile/trunk/src/z3c/extfile/filter.txt
  U   z3c.extfile/trunk/src/z3c/extfile/testing.py

-=-
Modified: z3c.extfile/trunk/CHANGES.txt
===================================================================
--- z3c.extfile/trunk/CHANGES.txt	2008-07-14 11:29:47 UTC (rev 88344)
+++ z3c.extfile/trunk/CHANGES.txt	2008-07-14 13:14:06 UTC (rev 88345)
@@ -2,6 +2,13 @@
 Changes for z3c.extfile
 =======================
 
+0.2.0b2 (2008-07-14)
+====================
+
+- fixed a bug in the extfile wsgi filter that returned an empty string
+  if content-lenth is below 100 and the returned object is an
+  iterator.
+
 0.2.0b1 (2008-06-05)
 ====================
 

Modified: z3c.extfile/trunk/setup.py
===================================================================
--- z3c.extfile/trunk/setup.py	2008-07-14 11:29:47 UTC (rev 88344)
+++ z3c.extfile/trunk/setup.py	2008-07-14 13:14:06 UTC (rev 88345)
@@ -2,7 +2,7 @@
 
 setup(
     name = "z3c.extfile",
-    version = "0.2.0b1",
+    version = "0.2.0b2",
     author = "Zope Contributors",
     author_email = "zope3-dev at zope.org",
     description = "Large file handling for zope3",

Modified: z3c.extfile/trunk/src/z3c/extfile/filter.py
===================================================================
--- z3c.extfile/trunk/src/z3c/extfile/filter.py	2008-07-14 11:29:47 UTC (rev 88344)
+++ z3c.extfile/trunk/src/z3c/extfile/filter.py	2008-07-14 13:14:06 UTC (rev 88345)
@@ -108,6 +108,7 @@
         if self.doHandle is False:
             return self._orgStart()
         body = "".join(self.response)
+        self.response = [body]
         if not body.startswith('z3c.extfile.digest:'):
             return self._orgStart()
         digest, contentType, contentLength = getInfo(body)
@@ -128,10 +129,8 @@
         else:
             headers_out['content-length'] = str(len(f))
         headers_out = headers_out.items()
-        fw = self.env.get('wsgi.file_wrapper')
         self.real_start(self.status, headers_out, self.exc_info)
         return f.__iter__()
-#    return fw(f, BLOCK_SIZE)
 
     def _orgStart(self):
         self.real_start(self.status, self.headers_out, self.exc_info)

Modified: z3c.extfile/trunk/src/z3c/extfile/filter.txt
===================================================================
--- z3c.extfile/trunk/src/z3c/extfile/filter.txt	2008-07-14 11:29:47 UTC (rev 88344)
+++ z3c.extfile/trunk/src/z3c/extfile/filter.txt	2008-07-14 13:14:06 UTC (rev 88345)
@@ -185,6 +185,14 @@
     >>> res.headers
     [('content-length', '1026603'), ('content-type', 'text/plain')]
 
+It needs to be an extfile info content, otherwise the original content
+is returned.
+
+    >>> info='noextfile:4934828cf300711df0af9879b0b479c1c18e5707'
+    >>> res = app.get('/%s' % info, extra_environ=env)
+    >>> res.body
+    'noextfile:4934828cf300711df0af9879b0b479c1c18e5707'
+
 Edge Cases
 ==========
 

Modified: z3c.extfile/trunk/src/z3c/extfile/testing.py
===================================================================
--- z3c.extfile/trunk/src/z3c/extfile/testing.py	2008-07-14 11:29:47 UTC (rev 88344)
+++ z3c.extfile/trunk/src/z3c/extfile/testing.py	2008-07-14 13:14:06 UTC (rev 88345)
@@ -30,15 +30,22 @@
     def __call__(self, environ, start_response):
         method = environ.get('REQUEST_METHOD')
         if method=='POST':
-            start_response("200 OK", [('Content-Type', 'text/plain')])
+            writer = start_response("200 OK", [('Content-Type',
+                                                'text/plain')])
             return [l for l in environ.get('wsgi.input')]
         else:
             path = environ.get('PATH_INFO')[1:]
-            start_response("200 OK", [('Content-Type', 'text/plain'),
-                                      ('Content-Length', str(len(path))),
-                                      ])
-            return [path]
+            writer = start_response("200 OK", [('Content-Type', 'text/plain'),
+                                               ('Content-Length', str(len(path))),
+                                               ])
+            return iter([path])
 
+        return []
+#            return writer([path])
+#             import pdb;pdb.set_trace()
+#             for p in path:
+#                 yield p
 
+
 def app_factory(global_conf, **local_conf):
     return In2OutApplication()



More information about the Checkins mailing list