[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser - viewmeta.py:1.17.2.1
Steve Alexander
steve@cat-box.net
Tue, 1 Apr 2003 14:53:36 -0500
Update of /cvs-repository/Zope3/src/zope/app/publisher/browser
In directory cvs.zope.org:/tmp/cvs-serv9941/src/zope/app/publisher/browser
Modified Files:
Tag: stevea-contextaware_in_c-branch
viewmeta.py
Log Message:
Initial checkin of context wrappers that are context aware, written in C.
=== Zope3/src/zope/app/publisher/browser/viewmeta.py 1.17 => 1.17.2.1 ===
--- Zope3/src/zope/app/publisher/browser/viewmeta.py:1.17 Tue Mar 25 10:19:59 2003
+++ Zope3/src/zope/app/publisher/browser/viewmeta.py Tue Apr 1 14:53:04 2003
@@ -47,7 +47,7 @@
from zope.app.security.permission import checkPermission
-from zope.proxy.context import ContextMethod, ContextAware
+from zope.proxy.context import ContextMethod
from zope.app.publisher.browser.globalbrowsermenuservice \
import menuItemDirective
@@ -151,8 +151,9 @@
if not hasattr(original_class, 'browserDefault'):
cdict = {
'browserDefault':
- lambda self, request:
- (getattr(self, attribute), ())
+ ContextMethod(lambda self, request:
+ (getattr(self, attribute), ())
+ )
}
else:
cdict = {}
@@ -320,8 +321,6 @@
m = class_.publishTraverse.__get__(self)
return m(request, name)
- publishTraverse = ContextMethod(publishTraverse)
-
else:
def publishTraverse(self, request, name,
pages=pages, getattr=getattr):
@@ -331,17 +330,17 @@
raise NotFoundError(self, name, request)
- cdict['publishTraverse'] = publishTraverse
+ cdict['publishTraverse'] = ContextMethod(publishTraverse)
if not hasattr(class_, 'browserDefault'):
if self.default or self.pages:
default = self.default or self.pages[0][0]
- cdict['browserDefault'] = (
+ cdict['browserDefault'] = ContextMethod(
lambda self, request, default=default:
(self, (default, ))
)
elif providesCallable(class_):
- cdict['browserDefault'] = (
+ cdict['browserDefault'] = ContextMethod(
lambda self, request: (self, ())
)
@@ -479,11 +478,12 @@
return for_
-class simple(BrowserView, ContextAware):
+class simple(BrowserView):
__implements__ = IBrowserPublisher, BrowserView.__implements__
def publishTraverse(self, request, name):
raise NotFoundError(self, name, request)
+ publishTraverse = ContextMethod(publishTraverse)
def __call__(self, *a, **k):
# If a class doesn't provide it's own call, then get the attribute
@@ -495,6 +495,7 @@
meth = getattr(self, attr)
return meth(*a, **k)
+ __call__ = ContextMethod(__call__)
def providesCallable(class_):
if hasattr(class_, '__call__'):