[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate - simpleviewclass.py:1.6 viewpagetemplatefile.py:1.4

Steve Alexander steve@cat-box.net
Tue, 8 Apr 2003 08:22:08 -0400


Update of /cvs-repository/Zope3/src/zope/app/pagetemplate
In directory cvs.zope.org:/tmp/cvs-serv11790/src/zope/app/pagetemplate

Modified Files:
	simpleviewclass.py viewpagetemplatefile.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/pagetemplate/simpleviewclass.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/pagetemplate/simpleviewclass.py:1.5	Fri Apr  4 10:49:37 2003
+++ Zope3/src/zope/app/pagetemplate/simpleviewclass.py	Tue Apr  8 08:21:37 2003
@@ -21,21 +21,23 @@
 from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.security.checker import defineChecker, NamesChecker
-from zope.proxy.context import ContextAware
+from zope.proxy.context import ContextMethod
 from zope.publisher.interfaces import NotFound
 
-class simple(ContextAware, BrowserView):
+class simple(BrowserView):
 
     __implements__ = IBrowserPublisher, BrowserView.__implements__
 
     def browserDefault(self, request):
         return self, ()
+    browserDefault = ContextMethod(browserDefault)
 
     def publishTraverse(self, request, name):
         if name == 'index.html':
             return self.index
 
         raise NotFound(self, name, request)
+    publishTraverse = ContextMethod(publishTraverse)
 
     # XXX: we need some unittests for this !!!
     def __getitem__(self, name):
@@ -43,6 +45,7 @@
 
     def __call__(self, template_usage=u'', *args, **kw):
         return self.index(template_usage, *args, **kw)
+    __call__ = ContextMethod(__call__)
 
 def SimpleViewClass(src, offering=None, used_for=None, bases=(), usage=u''):
     if offering is None:


=== Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py:1.3	Tue Mar 25 06:23:08 2003
+++ Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py	Tue Apr  8 08:21:37 2003
@@ -14,16 +14,17 @@
 """
 See ViewPageTemplateFile
 
-$Id%
+$Id$
 """
 __metaclass__ = type # All classes are new style when run with Python 2.2+
 
 from zope.pagetemplate.pagetemplatefile import PageTemplateFile
 from zope.component import getView
 from zope.app.pagetemplate.engine import AppPT
+from zope.proxy.context import ContextDescriptor
 import sys
 
-class ViewPageTemplateFile(AppPT, PageTemplateFile):
+class ViewPageTemplateFile(AppPT, PageTemplateFile, ContextDescriptor):
     """Page Templates used as methods of views defined as Python classes.
     """
 
@@ -54,10 +55,6 @@
 
     def __get__(self, instance, type=None):
         return BoundPageTemplate(self, instance)
-
-    # Instances of this class are pretending to be methods.
-    # In general, they need to be ContextMethods.
-    __Zope_ContextWrapper_contextful_get__ = True
 
 class ViewMapper:
     def __init__(self, ob, request):