[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/testing/functional.py Added an abort to make sure than pending changes are cancelled before

Jim Fulton jim at zope.com
Mon Apr 25 16:18:45 EDT 2005


Log message for revision 30175:
  Added an abort to make sure than pending changes are cancelled before
  a request is close.
  

Changed:
  U   Zope3/trunk/src/zope/app/testing/functional.py

-=-
Modified: Zope3/trunk/src/zope/app/testing/functional.py
===================================================================
--- Zope3/trunk/src/zope/app/testing/functional.py	2005-04-25 20:18:43 UTC (rev 30174)
+++ Zope3/trunk/src/zope/app/testing/functional.py	2005-04-25 20:18:45 UTC (rev 30175)
@@ -357,14 +357,20 @@
                     object = publication.getApplication(request)
                     object = request.traverse(object)
                     publication.afterTraversal(request, object)
-                except (KeyError, NameError, AttributeError, Unauthorized, Forbidden):
-                    e = traceback.format_exception_only(*sys.exc_info()[:2])[-1]
+                except (KeyError, NameError, AttributeError, Unauthorized,
+                        Forbidden):
+                    e = traceback.format_exception_only(
+                        *sys.exc_info()[:2])[-1]
                     errors.append((a, e.strip()))
             finally:
                 publication.endRequest(request, object)
                 self.setSite(old_site)
-                # Bad Things(TM) related to garbage collection and special
-                # __del__ methods happen if request.close() is not called here
+
+                # Make sure we don't have pending changes
+                abort()
+                
+                # The request should always be closed to free resources
+                # held by the request
                 if request:
                     request.close()
         if errors:



More information about the Zope3-Checkins mailing list