[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/ - left behind some comments for the next person who tries to understand that code

Yvo Schubbe y.2010 at wcm-solutions.de
Sat Apr 17 05:04:23 EDT 2010


Log message for revision 111013:
  - left behind some comments for the next person who tries to understand that code
  - re-synced Test.publish_module with Publish.publish_module_standard

Changed:
  U   Zope/trunk/src/ZPublisher/Publish.py
  U   Zope/trunk/src/ZPublisher/Test.py

-=-
Modified: Zope/trunk/src/ZPublisher/Publish.py
===================================================================
--- Zope/trunk/src/ZPublisher/Publish.py	2010-04-17 00:37:40 UTC (rev 111012)
+++ Zope/trunk/src/ZPublisher/Publish.py	2010-04-17 09:04:22 UTC (rev 111013)
@@ -224,6 +224,7 @@
             else:
                 stdout=response.stdout
 
+            # debug is just used by tests (has nothing to do with debug_mode!)
             response.handle_errors = not debug
 
             if request is None:
@@ -237,9 +238,16 @@
 
             response = publish(request, module_name, after_list, debug=debug)
         except (SystemExit, ImportError):
+            # XXX: Rendered ImportErrors were never caught here because they
+            # were re-raised as string exceptions. Maybe we should handle
+            # ImportErrors like all other exceptions. Currently they are not
+            # re-raised at all, so they don't show up here.
             must_die = sys.exc_info()
             request.response.exception(1)
         except:
+            # debug is just used by tests (has nothing to do with debug_mode!)
+            if debug:
+                raise
             request.response.exception()
             status = response.getStatus()
 

Modified: Zope/trunk/src/ZPublisher/Test.py
===================================================================
--- Zope/trunk/src/ZPublisher/Test.py	2010-04-17 00:37:40 UTC (rev 111012)
+++ Zope/trunk/src/ZPublisher/Test.py	2010-04-17 09:04:22 UTC (rev 111013)
@@ -189,6 +189,7 @@
             else:
                 stdout=response.stdout
 
+            # debug is just used by tests (has nothing to do with debug_mode!)
             response.handle_errors = not debug
 
             if request is None:
@@ -203,9 +204,14 @@
             for k, v in extra.items(): request[k]=v
             response = publish(request, module_name, after_list, debug=debug)
         except (SystemExit, ImportError):
+            # XXX: Rendered ImportErrors were never caught here because they
+            # were re-raised as string exceptions. Maybe we should handle
+            # ImportErrors like all other exceptions. Currently they are not
+            # re-raised at all, so they don't show up here.
             must_die = sys.exc_info()
             request.response.exception(1)
         except:
+            # debug is just used by tests (has nothing to do with debug_mode!)
             if debug:
                 raise
             request.response.exception()



More information about the Zope-Checkins mailing list