[Checkins] SVN: five.grok/trunk/src/five/grok/ Adjust five.grok to the changes I've made on grokcore.view:

Philipp von Weitershausen philikon at philikon.de
Sat Jul 19 22:45:25 EDT 2008


Log message for revision 88638:
  Adjust five.grok to the changes I've made on grokcore.view:
  
  * grokcore.view.GrokView was renamed to just View
  * Implement a ViewSecurityGrokker to take care of security
  
  

Changed:
  U   five.grok/trunk/src/five/grok/components.py
  U   five.grok/trunk/src/five/grok/meta.py

-=-
Modified: five.grok/trunk/src/five/grok/components.py
===================================================================
--- five.grok/trunk/src/five/grok/components.py	2008-07-20 02:42:08 UTC (rev 88637)
+++ five.grok/trunk/src/five/grok/components.py	2008-07-20 02:45:24 UTC (rev 88638)
@@ -1,18 +1,17 @@
 from zope import interface
 from zope.annotation.interfaces import IAttributeAnnotatable
 
+import grokcore.view
 from grokcore.component.interfaces import IContext
 
 import Acquisition
 from OFS.SimpleItem import SimpleItem
 
-from grokcore.view import GrokView
-
 class Model(SimpleItem):
     # XXX Inheritance order is important here. If we reverse this,
     # then containers can't be models anymore because no unambigous MRO
     # can be established.
     interface.implements(IAttributeAnnotatable, IContext)
 
-class View(GrokView, Acquisition.Implicit):
-    pass
\ No newline at end of file
+class View(grokcore.view.View, Acquisition.Implicit):
+    pass

Modified: five.grok/trunk/src/five/grok/meta.py
===================================================================
--- five.grok/trunk/src/five/grok/meta.py	2008-07-20 02:42:08 UTC (rev 88637)
+++ five.grok/trunk/src/five/grok/meta.py	2008-07-20 02:45:24 UTC (rev 88638)
@@ -1,24 +1,19 @@
 import martian
 from five import grok
+import grokcore.view
 
 from Products.Five.security import protectClass
 from Globals import InitializeClass as initializeClass
 
-from grokcore.view.meta import ViewGrokkerBase
 
-def default_view_name(factory, module=None, **data):
-    return factory.__name__.lower()
-
-class ViewGrokker(ViewGrokkerBase):
+class ViewSecurityGrokker(martian.ClassGrokker):
     martian.component(grok.View)
+    martian.directive(grokcore.view.require, name='permission')
     
-    def execute(self, factory, config, context, layer, name, permission, **kw):
+    def execute(self, factory, config, permission, **kw):
         if permission is None:
             permission = 'zope.Public'
-            
-        return super(ViewGrokker, self).execute(factory, config, context, layer, name, permission, **kw)
-            
-    def protectName(self, config, factory, permission):
+
         config.action(
             discriminator = ('five:protectClass', factory),
             callable = protectClass,
@@ -31,3 +26,5 @@
             callable = initializeClass,
             args = (factory,)
             )
+
+        return True



More information about the Checkins mailing list