[Checkins] SVN: grok/trunk/ Moved the ``make_checker`` util function to grokcore.view.

Souheil CHELFOUH souheil at chelfouh.com
Mon Nov 1 16:37:57 EDT 2010


Log message for revision 118117:
  Moved the ``make_checker`` util function to grokcore.view.
  

Changed:
  U   grok/trunk/CHANGES.txt
  U   grok/trunk/src/grok/ftests/security/security_view.py
  U   grok/trunk/src/grok/meta.py
  U   grok/trunk/src/grok/util.py

-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt	2010-11-01 20:21:38 UTC (rev 118116)
+++ grok/trunk/CHANGES.txt	2010-11-01 20:37:57 UTC (rev 118117)
@@ -4,6 +4,10 @@
 1.3 (unreleased)
 ================
 
+- The `IGrokSecurityView` interface has been to ``grokcore.view``. 
+
+- The `make_checker` util function has been moved to ``grokcore.view``. 
+
 - Update to latest martian and grokcore.component.
 
 1.2.1 (2010-10-26)

Modified: grok/trunk/src/grok/ftests/security/security_view.py
===================================================================
--- grok/trunk/src/grok/ftests/security/security_view.py	2010-11-01 20:21:38 UTC (rev 118116)
+++ grok/trunk/src/grok/ftests/security/security_view.py	2010-11-01 20:37:57 UTC (rev 118117)
@@ -20,7 +20,7 @@
 We create a permission checker for this view, which allows everybody
 to use the `__call__` method::
 
-  >>> from grok.util import make_checker
+  >>> from grokcore.view import make_checker
   >>> make_checker(App, Index, None)
 
 However, when we want to watch this view, we run into trouble::

Modified: grok/trunk/src/grok/meta.py
===================================================================
--- grok/trunk/src/grok/meta.py	2010-11-01 20:21:38 UTC (rev 118116)
+++ grok/trunk/src/grok/meta.py	2010-11-01 20:37:57 UTC (rev 118117)
@@ -46,13 +46,14 @@
 
 import grok
 from grok import components
-from grok.util import make_checker
 from grok.interfaces import IRESTSkinType
 
 import grokcore.site.interfaces
 from grokcore.component.meta import default_context
 from grokcore.security.meta import PermissionGrokker
 
+from grokcore.view import make_checker
+from grokcore.view.meta.views import default_fallback_to_name
 
 class MethodPublisher(XMLRPCView, Location):
     """Copied from zope.app.publisher.xmlrpc to get rid of that dependency.

Modified: grok/trunk/src/grok/util.py
===================================================================
--- grok/trunk/src/grok/util.py	2010-11-01 20:21:38 UTC (rev 118116)
+++ grok/trunk/src/grok/util.py	2010-11-01 20:37:57 UTC (rev 118117)
@@ -19,29 +19,9 @@
 
 from zope import interface
 from zope.schema.interfaces import WrongType
-from zope.security.checker import NamesChecker, defineChecker
-
 from grokcore.view.util import url
-from grokcore.security.util import check_permission
 
 
-def make_checker(factory, view_factory, permission, method_names=None):
-    """Make a checker for a view_factory associated with factory.
-
-    These could be one and the same for normal views, or different
-    in case we make method-based views such as for JSON and XMLRPC.
-    """
-    if method_names is None:
-        method_names = ['__call__']
-    if permission is not None:
-        check_permission(factory, permission)
-    if permission is None or permission == 'zope.Public':
-        checker = NamesChecker(method_names)
-    else:
-        checker = NamesChecker(method_names, permission)
-    defineChecker(view_factory, checker)
-
-
 def safely_locate_maybe(obj, parent, name):
     """Set an object's __parent__ (and __name__) if the object's
     __parent__ attribute doesn't exist yet or is None.



More information about the checkins mailing list