Commit d2565b62 authored by Jim Fulton's avatar Jim Fulton

Fixed bug in handling mapped permissions with no default for detination

permission.
parent c05217d1
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
__doc__='''Objects that implement Permission-based roles. __doc__='''Objects that implement Permission-based roles.
$Id: PermissionRole.py,v 1.4 1999/03/22 16:50:46 jim Exp $''' $Id: PermissionRole.py,v 1.5 1999/05/10 16:27:39 jim Exp $'''
__version__='$Revision: 1.4 $'[11:-2] __version__='$Revision: 1.5 $'[11:-2]
import sys import sys
...@@ -115,9 +115,9 @@ class PermissionRole(Base): ...@@ -115,9 +115,9 @@ class PermissionRole(Base):
def __of__(self, parent): def __of__(self, parent):
r=imPermissionRole() r=imPermissionRole()
n=r._p=self._p r._p=self._p
if hasattr(parent, n): r._d=getattr(parent,n) r._pa=parent
else: r._d=self._d r._d=self._d
return r return r
...@@ -172,9 +172,23 @@ class imPermissionRole(Base): ...@@ -172,9 +172,23 @@ class imPermissionRole(Base):
# The following methods are needed in the unlikely case that an unwrapped # The following methods are needed in the unlikely case that an unwrapped
# object is accessed: # object is accessed:
def __getitem__(self, i): return self._d[i] def __getitem__(self, i):
def __len__(self): return len(self._d) try:
v=self._v
except:
v=self._v=self.__of__(self._pa)
del self._pa
return v[i]
def __len__(self):
try:
v=self._v
except:
v=self._v=self.__of__(self._pa)
del self._pa
return len(v)
############################################################################## ##############################################################################
# Test functions: # Test functions:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment