[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/PageTemplate - SimpleViewClass.py:1.1.2.1.4.1 ViewPageTemplateFile.py:1.1.2.1.4.1

Jim Fulton jim@zope.com
Wed, 29 May 2002 11:10:16 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/PageTemplate
In directory cvs.zope.org:/tmp/cvs-serv12181/lib/python/Zope/App/PageTemplate

Modified Files:
      Tag: Zope3InWonderland-branch
	SimpleViewClass.py ViewPageTemplateFile.py 
Log Message:
- Added permission_id attribute to adapter and utility directives.

- Got rid of old getView, getResource, and getDefaultViewName.
  Renamed getRequestView to getView (and so on).

  Changed view interface to use context, rather than getContext.

  Introduced notion of presentation types (e.g. IBrowserPresentation, 
  which is cleaner than IBrowserPublisher).

- Began converting to get/queryFoo, which is much nicer.

- Many formatting fixups.



=== Zope3/lib/python/Zope/App/PageTemplate/SimpleViewClass.py 1.1.2.1 => 1.1.2.1.4.1 ===
 
 import sys
-from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
+from Zope.Publisher.Browser.BrowserView import BrowserView
 from ViewPageTemplateFile import ViewPageTemplateFile
 from Zope.Security.Checker import defineChecker, NamesChecker
 
-class simple(object):
-
-    __implements__=IBrowserPublisher
-    
-    # Boiler plate
-    def __init__(self, context):
-        self._context=context
-
-    def getContext(self):
-        return self._context
+class simple(BrowserView):
 
     def browserDefault(self, request):
         return self, ('index.html',)


=== Zope3/lib/python/Zope/App/PageTemplate/ViewPageTemplateFile.py 1.1.2.1 => 1.1.2.1.4.1 ===
 
 from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
-from Zope.ComponentArchitecture import getRequestView
+from Zope.ComponentArchitecture import getView
 from Engine import AppPT
 
 class ViewPageTemplateFile(AppPT, PageTemplateFile):
@@ -31,7 +31,7 @@
         namespace = super(ViewPageTemplateFile, self).pt_getContext(**_kw)
         namespace['request'] = request
         namespace['view'] = instance
-        namespace['context'] = context = instance.getContext()
+        namespace['context'] = context = instance.context
         namespace['views'] = ViewMapper(context, request)
         return namespace
 
@@ -50,7 +50,7 @@
         self.request = request 
 
     def __getitem__(self, name):
-        return getRequestView(self.ob, name, self.request)
+        return getView(self.ob, name, self.request)
 
 
 class BoundPageTemplate: