[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser - viewmeta.py:1.18
Steve Alexander
steve@cat-box.net
Tue, 8 Apr 2003 08:22:08 -0400
Update of /cvs-repository/Zope3/src/zope/app/publisher/browser
In directory cvs.zope.org:/tmp/cvs-serv11790/src/zope/app/publisher/browser
Modified Files:
viewmeta.py
Log Message:
Merge from branch.
ContextWrappers that rebind the 'self' of certain descriptors is now
implemented in C rather than in Python.
This checkin also fixes a couple of loss-of-context bugs when using
the __call__ method of views.
You'll need to rebuild your C extensions.
You *won't* need to toss your Data.fs ;-)
=== Zope3/src/zope/app/publisher/browser/viewmeta.py 1.17 => 1.18 ===
--- 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 8 08:21:37 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__'):