- Timestamp:
- 13 Nov 2011, 14:30:44 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r6918 r7104 47 47 48 48 def add_local_role(view, tab, **data): 49 form = view.request.form 50 localrole = form['local_role'] 51 if form.has_key('user'): 52 user = form['user'] 53 else: 49 localrole = view.request.form.get('local_role', None) 50 user = view.request.form.get('user', None) 51 if user is None or localrole is None: 54 52 view.flash('No user selected.') 55 53 view.redirect(view.url(view.context, '@@manage')+'#tab-%s' % tab) … … 58 56 role_manager.assignRoleToPrincipal(localrole, user) 59 57 notify(LocalRoleSetEvent(view.context, localrole, user, granted=True)) 60 #import pdb; pdb.set_trace()61 58 view.redirect(view.url(view.context, u'@@manage')+'#tab-%s' % tab) 62 59 return 63 60 64 61 def del_local_roles(view, tab, **data): 65 form = view.request.form 66 if form.has_key('role_id'): 67 child_id = form['role_id'] 68 else: 62 child_ids = view.request.form.get('role_id', None) 63 if child_ids is None: 69 64 view.flash('No local role selected.') 70 65 view.redirect(view.url(view.context, '@@manage')+'#tab-%s' % tab) 71 66 return 72 if not isinstance(child_id , list):73 child_id = [child_id]67 if not isinstance(child_ids, list): 68 child_ids = [child_ids] 74 69 deleted = [] 75 70 role_manager = IPrincipalRoleManager(view.context) 76 for id in child_id:77 localrole = id.split('|')[1]78 user_name = id.split('|')[0]71 for child_id in child_ids: 72 localrole = child_id.split('|')[1] 73 user_name = child_id.split('|')[0] 79 74 try: 80 75 role_manager.unsetRoleForPrincipal(localrole, user_name) 81 notify(LocalRoleSetEvent(view.context, localrole, user_name, granted=False)) 82 deleted.append(id) 76 notify(LocalRoleSetEvent( 77 view.context, localrole, user_name, granted=False)) 78 deleted.append(child_id) 83 79 except: 84 80 view.flash('Could not remove %s: %s: %s' % ( 85 id, sys.exc_info()[0], sys.exc_info()[1]))81 child_id, sys.exc_info()[0], sys.exc_info()[1])) 86 82 if len(deleted): 87 83 view.flash('Successfully removed: %s' % ', '.join(deleted))
Note: See TracChangeset for help on using the changeset viewer.