changeset 1146:40059e38427a

Ensure that the timer is called in Page.execute.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Mon, 07 Aug 2006 22:48:54 +0200
parents 2be5a05416bd
children 637d90f1209d 039e25408bac
files MoinMoin/Page.py
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Mon Aug 07 22:45:16 2006 +0200
+++ b/MoinMoin/Page.py	Mon Aug 07 22:48:54 2006 +0200
@@ -1385,19 +1385,21 @@
     def execute(self, request, parser, code):
         """ Write page content by executing cache code """            
         formatter = self.formatter
-        request.clock.start("execute")
-        from MoinMoin.macro import Macro
-        macro_obj = Macro(parser)        
-        # Fix __file__ when running from a zip package
-        import MoinMoin
-        if hasattr(MoinMoin, '__loader__'):
-            __file__ = os.path.join(MoinMoin.__loader__.archive, 'dummy')
-
+        request.clock.start("Page.execute")
         try:
-            exec code
-        except "CacheNeedsUpdate": # convert the exception
-            raise Exception("CacheNeedsUpdate")
-        request.clock.stop("execute")
+            from MoinMoin.macro import Macro
+            macro_obj = Macro(parser)        
+            # Fix __file__ when running from a zip package
+            import MoinMoin
+            if hasattr(MoinMoin, '__loader__'):
+                __file__ = os.path.join(MoinMoin.__loader__.archive, 'dummy')
+    
+            try:
+                exec code
+            except "CacheNeedsUpdate": # convert the exception
+                raise Exception("CacheNeedsUpdate")
+        finally:
+            request.clock.stop("Page.execute")
 
     def loadCache(self, request):
         """ Return page content cache or raises 'CacheNeedsUpdate' """