CherryPy / cherrypy /

Diff from to


 import cherrypy
 from cherrypy import _cpcgifs, _cpconfig
 from cherrypy._cperror import format_exc, bare_error
-from cherrypy.lib import http
+from cherrypy.lib import http, file_generator
 class Hook(object):
                                           # FieldStorage only recognizes POST.
                                           environ={'REQUEST_METHOD': "POST"},
-        except http.MaxSizeExceeded:
-            # Post data is too big
-            raise cherrypy.HTTPError(413)
+        except Exception, e:
+            if e.__class__.__name__ == 'MaxSizeExceeded':
+                # Post data is too big
+                raise cherrypy.HTTPError(413)
+            else:
+                raise
         # Note that, if headers['Content-Type'] is multipart/*,
         # then forms.file will not exist; instead, each form[key]
-def file_generator(input, chunkSize=65536):
-    """Yield the given input (a file object) in chunks (default 64k). (Core)"""
-    chunk =
-    while chunk:
-        yield chunk
-        chunk =
-    input.close()
 class Body(object):
     """The body of the HTTP response (the response entity)."""