Commits

Remi Delon  committed c86d278

Fixed test for filter.
Fixed default _cpOnError to use a list fo cpg.response.body

  • Participants
  • Parent commits fb40665
  • Branches cherrypy

Comments (0)

Files changed (3)

File _cpdefaults.py

     import traceback, StringIO
     bodyFile = StringIO.StringIO()
     traceback.print_exc(file = bodyFile)
-    cpg.response.body = bodyFile.getvalue()
+    cpg.response.body = [bodyFile.getvalue()]
     cpg.response.headerMap['Content-Type'] = 'text/plain'
 
 def _cpSaveSessionData(sessionId, sessionData, expirationTime,

File _cphttptools.py

         # TODO: in some cases exceptions and filters are conflicting; 
         # error reporting seems to be broken in some cases. This code is 
         # a helper to check it
-        print "%"*80
         traceback.print_exc()
-        print "%"*80
         err = ""
         exc_info_1 = sys.exc_info()[1]
         if hasattr(exc_info_1, 'args') and len(exc_info_1.args) >= 1:
             for line in cpg.response.body:
                 wfile.write(line)
         except:
-            # TODO: in some cases exceptions and filters are conflicting; 
-            # error reporting seems to be broken in some cases. This code is 
-            # a helper to check it
-            #print "%"*80
-            #traceback.print_exc()
-            #print "%"*80
             bodyFile = StringIO.StringIO()
             traceback.print_exc(file = bodyFile)
             body = bodyFile.getvalue()
     # Remove "root" from objectPathList and join it to get objectPath
     cpg.request.objectPath = '/' + '/'.join(objectPathList[1:])
     body = func(*(virtualPathList + cpg.request.paramList), **(cpg.request.paramMap))
-    
+
     # builds a uniform return type
     if not isinstance(body, types.GeneratorType):
         cpg.response.body = [body]

File test/helper.py

 class Shutdown:
     def all(self):
         cpg.server.stop()
+        return ""
     all.exposed = True
 cpg.root.shutdown = Shutdown()
 def f(*a, **kw): return ""