Commit 85cc5cc8 authored by Tres Seaver's avatar Tres Seaver

Readability.

parent 30a5419d
...@@ -18,7 +18,8 @@ class AccessRule(NameCaller): ...@@ -18,7 +18,8 @@ class AccessRule(NameCaller):
meta_type = 'Set Access Rule' meta_type = 'Set Access Rule'
def __call__(self, container, request): def __call__(self, container, request):
if SUPPRESS_ACCESSRULE: return if SUPPRESS_ACCESSRULE:
return
if '_SUPPRESS_ACCESSRULE' in _swallow(request, '_SUPPRESS'): if '_SUPPRESS_ACCESSRULE' in _swallow(request, '_SUPPRESS'):
request.setVirtualRoot(request.steps) request.setVirtualRoot(request.steps)
return return
...@@ -44,8 +45,10 @@ def manage_addAccessRule(self, method_id=None, REQUEST=None, **ignored): ...@@ -44,8 +45,10 @@ def manage_addAccessRule(self, method_id=None, REQUEST=None, **ignored):
if method_id is None or (REQUEST and REQUEST.form.has_key('none')): if method_id is None or (REQUEST and REQUEST.form.has_key('none')):
rules = unregisterBeforeTraverse(self, 'AccessRule') rules = unregisterBeforeTraverse(self, 'AccessRule')
if rules: if rules:
try: del getattr(self, rules[0].name).icon try:
except: pass del getattr(self, rules[0].name).icon
except:
pass
if REQUEST: if REQUEST:
return MessageDialog(title='No Access Rule', return MessageDialog(title='No Access Rule',
message='This object now has no Access Rule', message='This object now has no Access Rule',
...@@ -53,13 +56,16 @@ def manage_addAccessRule(self, method_id=None, REQUEST=None, **ignored): ...@@ -53,13 +56,16 @@ def manage_addAccessRule(self, method_id=None, REQUEST=None, **ignored):
elif method_id and hasattr(self, method_id): elif method_id and hasattr(self, method_id):
rules = unregisterBeforeTraverse(self, 'AccessRule') rules = unregisterBeforeTraverse(self, 'AccessRule')
if rules: if rules:
try: del getattr(self, rules[0].name).icon try:
except: pass del getattr(self, rules[0].name).icon
except:
pass
hook = AccessRule(method_id) hook = AccessRule(method_id)
registerBeforeTraverse(self, hook, 'AccessRule', 1) registerBeforeTraverse(self, hook, 'AccessRule', 1)
try: try:
getattr(self, method_id).icon = 'misc_/SiteAccess/AccessRule.gif' getattr(self, method_id).icon = 'misc_/SiteAccess/AccessRule.gif'
except: pass except:
pass
if REQUEST: if REQUEST:
return MessageDialog(title='Access Rule Set', return MessageDialog(title='Access Rule Set',
message='"%s" is now the Access Rule for this object' message='"%s" is now the Access Rule for this object'
......
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