[Checkins] SVN: five.grok/branches/zope212/ Removed Acquisition from the view and viewlet base classes.

Hanno Schlichting plone at hannosch.info
Tue Apr 7 10:58:29 EDT 2009


Log message for revision 98976:
  Removed Acquisition from the view and viewlet base classes.
  

Changed:
  U   five.grok/branches/zope212/docs/HISTORY.txt
  U   five.grok/branches/zope212/setup.py
  U   five.grok/branches/zope212/src/five/grok/components.py

-=-
Modified: five.grok/branches/zope212/docs/HISTORY.txt
===================================================================
--- five.grok/branches/zope212/docs/HISTORY.txt	2009-04-07 14:44:06 UTC (rev 98975)
+++ five.grok/branches/zope212/docs/HISTORY.txt	2009-04-07 14:58:29 UTC (rev 98976)
@@ -1,11 +1,13 @@
 Changelog for five.grok
 -----------------------
 
-five.grok - 1.0b1 (unreleased)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+five.grok - 2.0dev (unreleased)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-* ...
+* Removed Acquisition from the view and viewlet base classes.
+  [hannosch]
 
+
 five.grok - 1.0a2 (2008-11-23)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Modified: five.grok/branches/zope212/setup.py
===================================================================
--- five.grok/branches/zope212/setup.py	2009-04-07 14:44:06 UTC (rev 98975)
+++ five.grok/branches/zope212/setup.py	2009-04-07 14:58:29 UTC (rev 98976)
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 import os
 
-version = '1.0b1dev'
+version = '2.0dev'
 
 setup(name='five.grok',
       version=version,
@@ -31,8 +31,9 @@
         'martian',
         'grokcore.component',
         'grokcore.formlib',
-        'grokcore.view >= 1.2',
+        'grokcore.view',
         'grokcore.viewlet',
         'grokcore.security',
+        'Zope2',
         ],
       )

Modified: five.grok/branches/zope212/src/five/grok/components.py
===================================================================
--- five.grok/branches/zope212/src/five/grok/components.py	2009-04-07 14:44:06 UTC (rev 98975)
+++ five.grok/branches/zope212/src/five/grok/components.py	2009-04-07 14:58:29 UTC (rev 98976)
@@ -19,7 +19,6 @@
 import sys
 
 from zope.annotation.interfaces import IAttributeAnnotatable
-from zope.app.pagetemplate.viewpagetemplatefile import ViewMapper
 from zope import interface, component
 
 from grokcore.component.interfaces import IContext
@@ -34,19 +33,14 @@
 
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile \
     as BaseViewPageTemplateFile
-from Products.Five.browser.pagetemplatefile import getEngine
 from Products.Five.browser import resource
 from Products.Five.formlib import formbase
 from Products.Five.viewlet.manager import ViewletManagerBase as \
     ZopeTwoBaseViewletManager
-from Products.PageTemplates.Expressions import SecureModuleImporter
-from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 from OFS.SimpleItem import SimpleItem
 from OFS.Folder import Folder
 
-import Acquisition
 
-
 class Model(SimpleItem):
     interface.implements(IAttributeAnnotatable, IContext)
 
@@ -55,61 +49,9 @@
     interface.implements(IAttributeAnnotatable, IContext)
 
 
-class View(grokcore.view.View, Acquisition.Explicit):
+class View(grokcore.view.View):
+    pass
 
-    def __init__(self, *args):
-        super(View, self).__init__(*args)
-        if not (self.static is None):
-            # static should be wrapper correctly with acquisition,
-            # otherwise you will not be able to compute URL for
-            # resources.
-            self.static = self.static.__of__(self)
-
-    # We let getPhysicalPath to be acquired. This make static URL's
-    # work, and prevent us to inherit from Acquisition.Implicit
-    getPhysicalPath = Acquisition.Acquired
-
-
-# TODO: This should probably move to Products.Five.browser
-
-class ViewAwareZopePageTemplate(ZopePageTemplate):
-
-    def pt_getEngine(self):
-        return getEngine()
-
-    def pt_getContext(self):
-        try:
-            root = self.getPhysicalRoot()
-        except AttributeError:
-            try:
-                root = self.context.getPhysicalRoot()
-            except AttributeError:
-                root = None
-
-        view = self._getContext()
-        here = Acquisition.aq_inner(self.context)
-
-        request = getattr(root, 'REQUEST', None)
-        c = {'template': self,
-             'here': here,
-             'context': here,
-             'container': here,
-             'nothing': None,
-             'options': {},
-             'root': root,
-             'request': request,
-             'modules': SecureModuleImporter,
-             }
-        if view is not None:
-            c['view'] = view
-            c['views'] = ViewMapper(here, request)
-
-        if hasattr(self, 'pt_grokContext'):
-            c.update(self.pt_grokContext)
-
-        return c
-
-
 class ViewPageTemplateFile(BaseViewPageTemplateFile):
 
     def pt_getContext(self):
@@ -121,9 +63,6 @@
 
 class ZopeTwoPageTemplate(PageTemplate):
 
-    def setFromString(self, string):
-        self._template = ViewAwareZopePageTemplate(id=None, text=string)
-
     def setFromFilename(self, filename, _prefix=None):
         self._template = ViewPageTemplateFile(filename, _prefix)
 
@@ -219,9 +158,6 @@
             # XXX See View
             self.static = self.static.__of__(self)
 
-    # XXX See View
-    getPhysicalPath = Acquisition.Acquired
-
     def filter(self, viewlets):
         # XXX Need Zope 2 filter
         return ZopeTwoBaseViewletManager.filter(self, viewlets)
@@ -231,15 +167,6 @@
         return ZopeTwoBaseViewletManager.__getitem__(self, key)
 
 
-class Viewlet(BaseViewlet, Acquisition.Explicit):
+class Viewlet(BaseViewlet):
 
     martian.baseclass()
-
-    def __init__(self, context, request, view, manager):
-        super(Viewlet, self).__init__(context, request, view, manager)
-        if not (self.static is None):
-            # XXX See View
-            self.static = self.static.__of__(self)
-
-    # XXX See View
-    getPhysicalPath = Acquisition.Acquired



More information about the Checkins mailing list