changeset 4200:c21991eed9c9

Fixed: attribute lookup handling, in general as in uid_generator
author Florian Krupicka <florian.krupicka@googlemail.com>
date Wed, 02 Jul 2008 18:50:37 +0200
parents 04c37245e12d
children 40acd13fb3d6
files MoinMoin/web/contexts.py
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/contexts.py	Wed Jul 02 16:50:59 2008 +0200
+++ b/MoinMoin/web/contexts.py	Wed Jul 02 18:50:37 2008 +0200
@@ -275,10 +275,11 @@
     _login_messages = EnvironProxy('_login_messages', lambda o: [])
     _login_multistage = EnvironProxy('_login_multistage', None)
     _setuid_real_user = EnvironProxy('_setuid_real_user', None)
+    pages = EnvironProxy('pages', lambda o: {})
 
     def uid_generator(self):
         pagename = None
-        if hasattr(self, 'page') and self.page.page_name:
+        if hasattr(self, 'page') and hasattr(self.page, 'page_name'):
             pagename = self.page.page_name
         return UniqueIDGenerator(pagename=pagename)
     uid_generator = EnvironProxy(uid_generator)
@@ -351,17 +352,11 @@
 class HTTPContext(Context, HTTPMixin, ConfigMixin, UserMixin,
                   LanguageMixin, AuxilaryMixin):
     """ Context to act mainly in HTTP handling related phases. """
-    def __getattribute__(self, name):
+    def __getattr__(self, name):
         try:
+            return getattr(self.request, name)
+        except AttributeError, e:
             return super(HTTPContext, self).__getattribute__(name)
-        except AttributeError:
-            try:
-                return getattr(self.request, name)
-            except AttributeError:
-                msg = "'%s' object has no attribute '%s'"
-                msg = msg % (self.__class__.__name__,
-                             name)
-                raise AttributeError(msg)
 
 class RenderContext(Context, RedirectMixin, ConfigMixin, UserMixin,
                     LanguageMixin, ThemeMixin, AuxilaryMixin,
@@ -377,5 +372,6 @@
 class XMLRPCContext(HTTPContext):
     """ Context to act during a XMLRPC request. """
 
-class AllContext(HTTPContext, RenderContext, AuxilaryMixin):
+class AllContext(HTTPContext, RenderContext):
     """ Catchall context to be able to quickly test old Moin code. """
+