Skip to content

Commit

Permalink
Backport fix for LP#245649.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Jul 6, 2008
1 parent 8406133 commit 4b71ec5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions doc/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Zope Changes

Bugs fixed

- Launchpad #245649: the Products package is now a proper
"namespace package" under the rules specified by setuptools.

- Launchpad #239636: Ensure that HEAD requests lock an empty body
for NotFound errors.

Expand Down
3 changes: 2 additions & 1 deletion lib/python/AccessControl/Permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ def registerPermissions(permissions, defaultDefault=('Manager',)):
else:
perm, methods, default = setting
_registeredPermissions[perm]=1
Products_permissions = getattr(Products, '__ac_permissions__', ())
Products.__ac_permissions__=(
Products.__ac_permissions__+((perm,(),default),))
Products_permissions + ((perm, (), default),))
mangled=pname(perm) # get mangled permission name
if not hasattr(Globals.ApplicationDefaultPermissions, mangled):
setattr(Globals.ApplicationDefaultPermissions,
Expand Down
3 changes: 2 additions & 1 deletion lib/python/AccessControl/Role.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ def _setRoles(self, acl_type, acl_roles):

def possible_permissions(self):
d={}
for p in Products.__ac_permissions__:
Products_permissions = getattr(Products, '__ac_permissions__', ())
for p in Products_permissions:
d[p[0]]=1
for p in self.aq_acquire('_getProductRegistryData')('ac_permissions'):
d[p[0]]=1
Expand Down
3 changes: 2 additions & 1 deletion lib/python/OFS/ObjectManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ def all_meta_types(self, interfaces=None):
return meta_types

def _subobject_permissions(self):
return (Products.__ac_permissions__+
Products_permissions = getattr(Products, '__ac_permissions__', ())
return (Products_permissions +
self.aq_acquire('_getProductRegistryData')('ac_permissions')
)

Expand Down
7 changes: 6 additions & 1 deletion lib/python/Products/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
__ac_permissions__=()
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
6 changes: 4 additions & 2 deletions lib/python/ZClasses/Basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,21 @@ class ZClassPermissionsSheet(OFS.PropertySheets.PropertySheet,
manage=Globals.DTMLFile('dtml/classPermissions', globals())

def possible_permissions(self):
Products_permissions = getattr(Products, '__ac_permissions__', ())
r=map(
lambda p: p[0],
Products.__ac_permissions__+
Products_permissions +
self.aq_acquire('_getProductRegistryData')('ac_permissions')
)
r.sort()
return r

def manage_edit(self, selected=[], REQUEST=None):
"Remove some permissions"
Products_permissions = getattr(Products, '__ac_permissions__', ())
r=[]
for p in (
Products.__ac_permissions__+
Products_permissions +
self.aq_acquire('_getProductRegistryData')('ac_permissions')):
if p[0] in selected:
r.append(p)
Expand Down

0 comments on commit 4b71ec5

Please sign in to comment.