changeset 2026:5aa49f81db45

finishers: execute only once and make sure request.user is set
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 24 Apr 2007 12:06:54 +0200
parents d919b7b7b3e9
children 2203d6f9885e
files MoinMoin/request/__init__.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/request/__init__.py	Tue Apr 24 12:04:19 2007 +0200
+++ b/MoinMoin/request/__init__.py	Tue Apr 24 12:06:54 2007 +0200
@@ -226,6 +226,8 @@
             user_obj = self.cfg.session_handler.start(self, self._cookie)
             shfinisher = lambda request: self.cfg.session_handler.finish(request, self._cookie, request.user)
             self.add_finisher(shfinisher)
+            # set self.user even if _handle_auth_form raises an Exception
+            self.user = None
             self.user = self._handle_auth_form(user_obj)
             del user_obj
             self.cfg.session_handler.after_auth(self, self._cookie, self.user)
@@ -1451,6 +1453,8 @@
         """
         for method in self._finishers:
             method(self)
+        # only execute finishers once
+        self._finishers = []
 
         try:
             del self.user