[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate - simpleviewclass.py:1.4.2.1 viewpagetemplatefile.py:1.3.2.1
Steve Alexander
steve@cat-box.net
Tue, 1 Apr 2003 14:53:35 -0500
Update of /cvs-repository/Zope3/src/zope/app/pagetemplate
In directory cvs.zope.org:/tmp/cvs-serv9941/src/zope/app/pagetemplate
Modified Files:
Tag: stevea-contextaware_in_c-branch
simpleviewclass.py viewpagetemplatefile.py
Log Message:
Initial checkin of context wrappers that are context aware, written in C.
=== Zope3/src/zope/app/pagetemplate/simpleviewclass.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/app/pagetemplate/simpleviewclass.py:1.4 Tue Mar 25 06:23:08 2003
+++ Zope3/src/zope/app/pagetemplate/simpleviewclass.py Tue Apr 1 14:53:03 2003
@@ -21,20 +21,22 @@
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
-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):
@@ -42,6 +44,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.3.2.1 ===
--- 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 1 14:53:03 2003
@@ -21,9 +21,10 @@
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):