Reverting part of r2378, since it's not ready yet.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/views/models/role.py Sat Mar 07 19:17:02 2009 +0000
+++ b/app/soc/views/models/role.py Sat Mar 07 19:23:32 2009 +0000
@@ -156,8 +156,6 @@
new_params['extra_dynaexclude'] = ['user', 'status', 'agreed_to_tos_on']
- new_params['disallow_last_resign'] = False
-
params = dicts.merge(params, new_params, sub_merge=True)
super(View, self).__init__(params=params)
@@ -436,29 +434,12 @@
resign = get_dict.get('resign')
if resign == 'true':
-
- if params.get('disallow_last_resign'):
- # check if the current role is the last for this scope
- fields = {'scope': role_entity.scope,
- 'status': 'active'}
- roles = logic.getForFields(fields, limit=2)
-
- # if there is more then one left we can safely resign
- resign = len(roles) > 1
- else:
- resign = True
+ # change the status of this role_entity to invalid
+ fields = {'status': 'invalid'}
+ logic.updateEntityProperties(role_entity, fields)
- if resign:
- # change the status of this role_entity to invalid
- fields = {'status': 'invalid'}
- logic.updateEntityProperties(role_entity, fields)
-
- # redirect to the roles listing
- return http.HttpResponseRedirect(redirect)
- else:
- # show error to the user
- context['not_allowed_to_resign'] = ugettext("This user can't be "
- "resigned, please make sure it's not the last %(name)s." % params)
+ # redirect to the roles listing
+ return http.HttpResponseRedirect(redirect)
# set the appropriate context
context['entity'] = role_entity