Commit 5fdc5ef2 authored by Evan Simpson's avatar Evan Simpson

Made application of __roles__ attempt attribute assignment first.

parent 2f8660ad
...@@ -228,7 +228,8 @@ class ProductContext: ...@@ -228,7 +228,8 @@ class ProductContext:
},) },)
m[name]=initial m[name]=initial
m[name+'__roles__']=pr try: initial.__roles__=pr
except: m[name+'__roles__']=pr
for method in constructors[1:]: for method in constructors[1:]:
if type(method) is tt: name, method = method if type(method) is tt: name, method = method
...@@ -236,7 +237,8 @@ class ProductContext: ...@@ -236,7 +237,8 @@ class ProductContext:
name=os.path.split(method.__name__)[-1] name=os.path.split(method.__name__)[-1]
if not productObject.__dict__.has_key(name): if not productObject.__dict__.has_key(name):
m[name]=method m[name]=method
m[name+'__roles__']=pr try: method.__roles__ = pr
except: m[name+'__roles__']=pr
if icon: if icon:
name=os.path.split(icon)[1] name=os.path.split(icon)[1]
......
...@@ -99,12 +99,10 @@ def default__class_init__(self): ...@@ -99,12 +99,10 @@ def default__class_init__(self):
for name, v in dict_items: for name, v in dict_items:
if hasattr(v,'_need__name__') and v._need__name__: if hasattr(v,'_need__name__') and v._need__name__:
v.__dict__['__name__']=name v.__dict__['__name__']=name
if name=='manage' or name[:7]=='manage_': if ((name=='manage' or name[:7]=='manage_') and
name=name+'__roles__' not hasattr(v, '__roles__')):
if not have(name): dict[name]='Manager', try: v.__roles__ = ('Manager',)
elif name=='manage' or name[:7]=='manage_' and type(v) is ft: except: dict[name+'__roles__'] = ('Manager',)
name=name+'__roles__'
if not have(name): dict[name]='Manager',
# Look for a SecurityInfo object on the class. If found, call its # Look for a SecurityInfo object on the class. If found, call its
# apply() method to generate __ac_permissions__ for the class. We # apply() method to generate __ac_permissions__ for the class. We
......
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