[Checkins] SVN: grok/trunk/ the permissions directive now is in grokcore.security
Jan Wijbrand Kolman
cvs-admin at zope.org
Mon Apr 30 13:19:12 UTC 2012
Log message for revision 125441:
the permissions directive now is in grokcore.security
Changed:
U grok/trunk/CHANGES.txt
U grok/trunk/src/grok/__init__.py
D grok/trunk/src/grok/directive.py
-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt 2012-04-30 13:17:03 UTC (rev 125440)
+++ grok/trunk/CHANGES.txt 2012-04-30 13:19:08 UTC (rev 125441)
@@ -4,9 +4,8 @@
1.10 (unreleased)
=================
-- Nothing changed yet.
+- The permissions() directive moved from grok to grokcore.security.
-
1.9 (2011-09-06)
================
Modified: grok/trunk/src/grok/__init__.py
===================================================================
--- grok/trunk/src/grok/__init__.py 2012-04-30 13:17:03 UTC (rev 125440)
+++ grok/trunk/src/grok/__init__.py 2012-04-30 13:19:08 UTC (rev 125441)
@@ -38,6 +38,7 @@
from grokcore.security import Permission
from grokcore.security import Public
from grokcore.security import require
+from grokcore.security import permissions
from grokcore.view import ContentProvider
from grokcore.view import PageTemplate
@@ -113,9 +114,6 @@
from grokcore.rest import restskin
from grokcore.traverser import traversable
-# this will be moved to ... something else soon
-from grok.directive import permissions
-
# BBB These two functions are meant for test fixtures and should be
# imported from grok.testing, not from grok.
from grok.testing import grok, grok_component
Deleted: grok/trunk/src/grok/directive.py
===================================================================
--- grok/trunk/src/grok/directive.py 2012-04-30 13:17:03 UTC (rev 125440)
+++ grok/trunk/src/grok/directive.py 2012-04-30 13:19:08 UTC (rev 125441)
@@ -1,58 +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.
-#
-##############################################################################
-"""Grok directives.
-"""
-
-import grok
-import martian
-import martian.util
-from grokcore.view.directive import TaggedValueStoreOnce
-
-
-class permissions(martian.Directive):
- """The `grok.permissions()` directive.
-
- This directive is used inside of a `grok.Role` subclass to list the
- permissions which each member of the role should always possess.
- Note that permissions should be passed as strings, and that several
- permissions they can simply be supplied as multiple arguments; there
- is no need to place them inside of a tuple or list::
-
- class MyRole(grok.Role):
- grok.permissions('page.CreatePage', 'page.EditPage')
- ...
-
- """
- scope = martian.CLASS
- store = martian.ONCE
- default = []
-
- def validate(self, *values):
- for value in values:
- if martian.util.check_subclass(value, grok.Permission):
- continue
- if martian.util.not_unicode_or_ascii(value):
- raise grok.GrokImportError(
- "You can only pass unicode values, ASCII values, or "
- "subclasses of grok.Permission to the '%s' directive."
- % self.name)
-
- def factory(self, *values):
- permission_ids = []
- for value in values:
- if martian.util.check_subclass(value, grok.Permission):
- permission_ids.append(grok.name.bind().get(value))
- else:
- permission_ids.append(value)
- return permission_ids
More information about the checkins
mailing list