[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser - viewmeta.py:1.10

Steve Alexander steve@cat-box.net
Mon, 3 Feb 2003 11:35:10 -0500


Update of /cvs-repository/Zope3/src/zope/app/publisher/browser
In directory cvs.zope.org:/tmp/cvs-serv27732/src/zope/app/publisher/browser

Modified Files:
	viewmeta.py 
Log Message:
added a __metaclass__ = type, not because it is strictly necessary,
but because its absence made me unsure of some things when I was
tracking down an unrelated bug.
Also, added back in the changes to make the auth service work.


=== Zope3/src/zope/app/publisher/browser/viewmeta.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/publisher/browser/viewmeta.py:1.9	Sun Feb  2 18:22:59 2003
+++ Zope3/src/zope/app/publisher/browser/viewmeta.py	Mon Feb  3 11:34:37 2003
@@ -41,8 +41,7 @@
 
 from zope.app.security.permission import checkPermission
 
-# from zope.proxy.context import ContextMethod, ContextAware
-from zope.proxy.context import ContextMethod
+from zope.proxy.context import ContextMethod, ContextAware
 
 from zope.app.publisher.browser.globalbrowsermenuservice \
      import menuItemDirective
@@ -109,7 +108,7 @@
     required = {}
 
     permission = _handle_permission(_context, permission, actions)
-            
+
     if not (class_ or template):
         raise ConfigurationError("Must specify a class or template")
 
@@ -154,10 +153,10 @@
 
             cdict['__page_attribute__'] = attribute
             class_ = type(class_.__name__, (class_, simple,), cdict)
-            
+
     else:
         class_ = SimpleViewClass(template)
-        
+
     for n in (attribute, 'browserDefault', '__call__', 'publishTraverse'):
         required[n] = permission
 
@@ -215,7 +214,7 @@
 
     def __call__(self):
         return ()
-                    
+
 # view (named view with pages)
 
 # This is a different case. We actually build a class with attributes
@@ -269,10 +268,10 @@
          allowed_interface, allowed_attributes, actions) = self.args
 
         required = {}
-                
+
         cdict = {}
         pages = {}
-        
+
         for pname, attribute, template in self.pages:
             if template:
                 cdict[pname] = ViewPageTemplateFile(template)
@@ -287,7 +286,7 @@
             required[pname] = permission
 
             pages[pname] = attribute
-            
+
         if hasattr(class_, 'publishTraverse'):
 
             # XXX This context trickery is a hack around a problem, I
@@ -295,7 +294,7 @@
 
             def publishTraverse(self, request, name,
                                 pages=pages, getattr=getattr):
-                
+
                 if name in pages:
                     return getattr(self, pages[name])
 
@@ -307,12 +306,12 @@
         else:
             def publishTraverse(self, request, name,
                                 pages=pages, getattr=getattr):
-                
+
                 if name in pages:
                     return getattr(self, pages[name])
-                
+
                 raise NotFoundError(self, name, request)
-            
+
         cdict['publishTraverse'] = publishTraverse
 
         if not hasattr(class_, 'browserDefault'):
@@ -445,10 +444,10 @@
 def _handle_for(_context, for_, actions):
     if for_ == '*':
         for_ = None
-        
+
     if for_ is not None:
         for_ = _context.resolve(for_)
-        
+
         actions .append(
             Action(discriminator = None, callable = handler,
                    args = ('Interfaces', 'provideInterface', None, for_)
@@ -456,8 +455,7 @@
 
     return for_
 
-# class simple(ContextAware, BrowserView):
-class simple(BrowserView):
+class simple(BrowserView, ContextAware):
     __implements__ = IBrowserPublisher, BrowserView.__implements__
 
     def publishTraverse(self, request, name):
@@ -473,6 +471,3 @@
 
         meth = getattr(self, attr)
         return meth(*a, **k)
-    
-        
-