[Checkins] SVN: grok/trunk/s there are no grokkers anymore in grok itself
Jan Wijbrand Kolman
cvs-admin at zope.org
Tue May 1 07:35:55 UTC 2012
Log message for revision 125449:
there are no grokkers anymore in grok itself
Changed:
U grok/trunk/setup.py
U grok/trunk/src/grok/configure.zcml
D grok/trunk/src/grok/meta.py
U grok/trunk/src/grok/meta.zcml
U grok/trunk/src/grok/testing.py
U grok/trunk/src/grok/tests/grokker/grokcomponent.py
U grok/trunk/src/grok/tests/zcml/directivemodule.py
U grok/trunk/src/grok/tests/zcml/directivepackage.py
-=-
Modified: grok/trunk/setup.py
===================================================================
--- grok/trunk/setup.py 2012-04-30 15:41:12 UTC (rev 125448)
+++ grok/trunk/setup.py 2012-05-01 07:35:51 UTC (rev 125449)
@@ -52,6 +52,7 @@
'grokcore.message',
'grokcore.rest',
'grokcore.security >= 1.1',
+ 'grokcore.security[role]',
'grokcore.site > 1.4',
'grokcore.traverser',
'grokcore.view >= 2.6.1',
Modified: grok/trunk/src/grok/configure.zcml
===================================================================
--- grok/trunk/src/grok/configure.zcml 2012-04-30 15:41:12 UTC (rev 125448)
+++ grok/trunk/src/grok/configure.zcml 2012-05-01 07:35:51 UTC (rev 125449)
@@ -38,6 +38,7 @@
<include package="zope.app.publication" />
<include package="zope.app.wsgi" />
+ <include package="grokcore.security" file="meta.zcml" />
<include package="grokcore.annotation" />
<include package="grokcore.chameleon" />
<include package="grokcore.formlib" />
Deleted: grok/trunk/src/grok/meta.py
===================================================================
--- grok/trunk/src/grok/meta.py 2012-04-30 15:41:12 UTC (rev 125448)
+++ grok/trunk/src/grok/meta.py 2012-05-01 07:35:51 UTC (rev 125449)
@@ -1,101 +0,0 @@
-#############################################################################
-#
-# Copyright (c) 2006-2007 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Grokkers for Grok-configured components.
-
-This `meta` module contains the actual grokker mechanisms for which the
-Grok web framework is named. A directive in the adjacent `meta.zcml`
-file directs the `martian` library to scan this file, where it discovers
-and registers the grokkers you see below. The grokkers are then active
-and available as `martian` recursively examines the packages and modules
-of a Grok-based web application.
-
-"""
-import zope.component.interface
-from zope import interface, component
-from zope.interface.interface import InterfaceClass
-from zope.publisher.interfaces.browser import IBrowserPublisher
-from zope.publisher.interfaces.http import IHTTPRequest
-
-from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
-from zope.securitypolicy.interfaces import IRole
-from zope.securitypolicy.rolepermission import rolePermissionManager
-
-from zope.i18nmessageid import Message
-from zope.intid import IntIds
-from zope.intid.interfaces import IIntIds
-from zope.catalog.catalog import Catalog
-from zope.catalog.interfaces import ICatalog
-from zope.location import Location
-from zope.exceptions.interfaces import DuplicationError
-from zope.publisher.xmlrpc import XMLRPCView
-
-import martian
-from martian.error import GrokError
-
-import grok
-from grok import components
-from grok.interfaces import IRESTSkinType
-
-import grokcore.site.interfaces
-from grokcore.security.meta import PermissionGrokker
-
-from grokcore.view import make_checker
-
-
-def default_fallback_to_name(factory, module, name, **data):
- return name
-
-
-class RoleGrokker(martian.ClassGrokker):
- """Grokker for components subclassed from `grok.Role`.
-
- Each role is registered as a global utility providing the service
- `IRole` under its own particular name, and then granted every
- permission named in its `grok.permission()` directive.
-
- """
- martian.component(grok.Role)
- martian.priority(martian.priority.bind().get(PermissionGrokker()) - 1)
- martian.directive(grok.name)
- martian.directive(grok.title, get_default=default_fallback_to_name)
- martian.directive(grok.description)
- martian.directive(grok.permissions)
-
- def execute(self, factory, config, name, title, description,
- permissions, **kw):
- if not name:
- raise GrokError(
- "A role needs to have a dotted name for its id. Use "
- "grok.name to specify one.", factory)
- # We can safely convert to unicode, since the directives makes sure
- # it is either unicode already or ASCII.
- if not isinstance(title, Message):
- title = unicode(title)
- if not isinstance(description, Message):
- description = unicode(description)
- role = factory(unicode(name), title, description)
-
- config.action(
- discriminator=('utility', IRole, name),
- callable=component.provideUtility,
- args=(role, IRole, name),
- )
-
- for permission in permissions:
- config.action(
- discriminator=('grantPermissionToRole', permission, name),
- callable=rolePermissionManager.grantPermissionToRole,
- args=(permission, name),
- )
- return True
Modified: grok/trunk/src/grok/meta.zcml
===================================================================
--- grok/trunk/src/grok/meta.zcml 2012-04-30 15:41:12 UTC (rev 125448)
+++ grok/trunk/src/grok/meta.zcml 2012-05-01 07:35:51 UTC (rev 125449)
@@ -14,6 +14,5 @@
<include package="grokcore.annotation" file="meta.zcml" />
<include package="grokcore.site" file="meta.zcml" />
<include package="grokcore.catalog" file="meta.zcml" />
- <grok:grok package=".meta" />
</configure>
Modified: grok/trunk/src/grok/testing.py
===================================================================
--- grok/trunk/src/grok/testing.py 2012-04-30 15:41:12 UTC (rev 125448)
+++ grok/trunk/src/grok/testing.py 2012-05-01 07:35:51 UTC (rev 125449)
@@ -43,7 +43,6 @@
zcml.do_grok('grokcore.traverser.meta', config)
zcml.do_grok('grokcore.rest.meta', config)
zcml.do_grok('grokcore.xmlrpc.meta', config)
- zcml.do_grok('grok.meta', config)
zcml.do_grok(module_name, config)
config.execute_actions()
Modified: grok/trunk/src/grok/tests/grokker/grokcomponent.py
===================================================================
--- grok/trunk/src/grok/tests/grokker/grokcomponent.py 2012-04-30 15:41:12 UTC (rev 125448)
+++ grok/trunk/src/grok/tests/grokker/grokcomponent.py 2012-05-01 07:35:51 UTC (rev 125449)
@@ -3,8 +3,7 @@
Let's first grok the meta module to define some basic grokkers::
>>> import grok
- >>> grok.testing.grok('grok.meta')
-
+
It is possible to grok an individual component. Let's define an adapter::
>>> from zope.interface import Interface
Modified: grok/trunk/src/grok/tests/zcml/directivemodule.py
===================================================================
--- grok/trunk/src/grok/tests/zcml/directivemodule.py 2012-04-30 15:41:12 UTC (rev 125448)
+++ grok/trunk/src/grok/tests/zcml/directivemodule.py 2012-05-01 07:35:51 UTC (rev 125449)
@@ -13,7 +13,7 @@
>>> from grok.tests.zcml.stoneage.cave import Cave
>>> cave = Cave()
-
+
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> from zope import component
Modified: grok/trunk/src/grok/tests/zcml/directivepackage.py
===================================================================
--- grok/trunk/src/grok/tests/zcml/directivepackage.py 2012-04-30 15:41:12 UTC (rev 125448)
+++ grok/trunk/src/grok/tests/zcml/directivepackage.py 2012-05-01 07:35:51 UTC (rev 125449)
@@ -16,7 +16,7 @@
>>> from grok.tests.zcml.stoneage.hunt.mammoth import Mammoth
>>> manfred = Mammoth()
>>> cave = Cave()
-
+
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> from zope import component
@@ -28,7 +28,7 @@
<h1>A comfy cave</h1>
</body>
</html>
-
+
>>> view = component.getMultiAdapter((manfred, request), name='index')
>>> print view()
<html>
More information about the checkins
mailing list