[Checkins] SVN: grok/trunk/ Fix issue
https://bugs.launchpad.net/grok/+bug/187590 where permissions
and roles registrations were not using the correct discriminator.
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Wed Apr 16 10:13:18 EDT 2008
Log message for revision 85439:
Fix issue https://bugs.launchpad.net/grok/+bug/187590 where permissions and roles registrations were not using the correct discriminator.
Changed:
U grok/trunk/CHANGES.txt
U grok/trunk/src/grok/ftests/security/require.py
U grok/trunk/src/grok/ftests/security/roles.py
U grok/trunk/src/grok/meta.py
-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt 2008-04-16 14:08:38 UTC (rev 85438)
+++ grok/trunk/CHANGES.txt 2008-04-16 14:13:17 UTC (rev 85439)
@@ -34,7 +34,7 @@
See also the ``upgrade notes``_ for information on how to update
your existing projects.
-
+
.. _``upgrade notes``: http://grok.zope.org/project/upgrade-notes
Bug fixes
@@ -86,6 +86,9 @@
``grok.Traverser`` failed in the face of (REST) ``PUT`` and
``DELETE``. XML-RPC also failed when custom traversal was in use.
+* Fix https://bugs.launchpad.net/grok/+bug/187590 where config action
+ discriminators for permission and role registrations were incorrect.
+
Restructuring
-------------
Modified: grok/trunk/src/grok/ftests/security/require.py
===================================================================
--- grok/trunk/src/grok/ftests/security/require.py 2008-04-16 14:08:38 UTC (rev 85438)
+++ grok/trunk/src/grok/ftests/security/require.py 2008-04-16 14:13:17 UTC (rev 85439)
@@ -11,7 +11,7 @@
When we log in (e.g. as a manager), we can access the view just fine:
>>> from zope.securitypolicy.rolepermission import rolePermissionManager
- >>> rolePermissionManager.grantPermissionToRole('grok.ViewPainting',
+ >>> rolePermissionManager.grantPermissionToRole('cave.ViewPainting',
... 'zope.Manager')
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
>>> browser.handleErrors = False
@@ -31,12 +31,12 @@
import zope.interface
class ViewPainting(grok.Permission):
- grok.name('grok.ViewPainting')
+ grok.name('cave.ViewPainting')
class Painting(grok.View):
grok.context(zope.interface.Interface)
- grok.require('grok.ViewPainting')
+ grok.require('cave.ViewPainting')
def render(self):
return 'What a beautiful painting.'
Modified: grok/trunk/src/grok/ftests/security/roles.py
===================================================================
--- grok/trunk/src/grok/ftests/security/roles.py 2008-04-16 14:08:38 UTC (rev 85438)
+++ grok/trunk/src/grok/ftests/security/roles.py 2008-04-16 14:13:17 UTC (rev 85439)
@@ -24,7 +24,7 @@
>>> from zope.securitypolicy.interfaces import IPrincipalRoleManager
>>> root = getRootFolder()
>>> IPrincipalRoleManager(root).assignRoleToPrincipal(
- ... 'grok.PaintingOwner', 'zope.anybody')
+ ... 'paint.PaintingOwner', 'zope.anybody')
>>> browser.open("http://localhost/@@cavepainting")
>>> print browser.contents
@@ -47,27 +47,27 @@
import zope.interface
class View(grok.Permission):
- grok.name('grok.ViewPainting')
+ grok.name('paint.ViewPainting')
class Edit(grok.Permission):
- grok.name('grok.EditPainting')
+ grok.name('paint.EditPainting')
class Erase(grok.Permission):
- grok.name('grok.ErasePainting')
+ grok.name('paint.ErasePainting')
class Approve(grok.Permission):
- grok.name('grok.ApprovePainting')
+ grok.name('paint.ApprovePainting')
class PaintingOwner(grok.Role):
- grok.name('grok.PaintingOwner')
+ grok.name('paint.PaintingOwner')
grok.title('Painting Owner')
grok.permissions(
- 'grok.ViewPainting', 'grok.EditPainting', 'grok.ErasePainting')
+ 'paint.ViewPainting', 'paint.EditPainting', 'paint.ErasePainting')
class CavePainting(grok.View):
grok.context(zope.interface.Interface)
- grok.require('grok.ViewPainting')
+ grok.require('paint.ViewPainting')
def render(self):
return 'What a beautiful painting.'
@@ -75,7 +75,7 @@
class EditCavePainting(grok.View):
grok.context(zope.interface.Interface)
- grok.require('grok.EditPainting')
+ grok.require('paint.EditPainting')
def render(self):
return 'Let\'s make it even prettier.'
@@ -83,7 +83,7 @@
class EraseCavePainting(grok.View):
grok.context(zope.interface.Interface)
- grok.require('grok.ErasePainting')
+ grok.require('paint.ErasePainting')
def render(self):
return 'Oops, mistake, let\'s erase it.'
@@ -91,7 +91,7 @@
class ApproveCavePainting(grok.View):
grok.context(zope.interface.Interface)
- grok.require('grok.ApprovePainting')
+ grok.require('paint.ApprovePainting')
def render(self):
return 'Painting owners cannot approve their paintings.'
Modified: grok/trunk/src/grok/meta.py
===================================================================
--- grok/trunk/src/grok/meta.py 2008-04-16 14:08:38 UTC (rev 85438)
+++ grok/trunk/src/grok/meta.py 2008-04-16 14:13:17 UTC (rev 85439)
@@ -98,7 +98,7 @@
[grok.ViewletManager])
module.__grok_viewletmanager__ = viewletmanager
return True
-
+
class AdapterGrokker(martian.ClassGrokker):
component_class = grok.Adapter
@@ -106,7 +106,7 @@
adapter_context = get_context(module_info, factory)
provides = get_provides(factory)
name = get_name(factory)
-
+
config.action(
discriminator=('adapter', adapter_context, provides, name),
callable=component.provideAdapter,
@@ -120,7 +120,7 @@
def grok(self, name, factory, module_info, config, **kw):
provides = get_provides(factory)
name = get_name(factory)
-
+
check_adapts(factory)
for_ = component.adaptedBy(factory)
@@ -160,7 +160,7 @@
def grok(self, name, factory, module_info, config, **kw):
view_context = get_context(module_info, factory)
-
+
methods = public_methods_from_class(factory)
default_permission = get_default_permission(factory)
@@ -247,7 +247,7 @@
view_context = get_context(module_info, factory)
factory.module_info = module_info
-
+
if util.check_subclass(factory, components.GrokForm):
# setup form_fields from context class if we've encountered a form
if getattr(factory, 'form_fields', None) is None:
@@ -693,7 +693,7 @@
unicode(util.class_annotation(factory, 'grok.description', '')))
config.action(
- discriminator=('utility', IPermission, name),
+ discriminator=('utility', IPermission, id),
callable=component.provideUtility,
args=(permission, IPermission, id),
order=self.priority
@@ -719,7 +719,7 @@
unicode(util.class_annotation(factory, 'grok.description', '')))
config.action(
- discriminator=('utility', IRole, name),
+ discriminator=('utility', IRole, id),
callable=component.provideUtility,
args=(role, IRole, id),
)
More information about the Checkins
mailing list