src/cm/views/user.py
changeset 105 f2ba05546abc
parent 93 955c0b239d86
child 110 f0d097bff6b2
--- a/src/cm/views/user.py	Wed Jan 20 20:43:55 2010 +0100
+++ b/src/cm/views/user.py	Wed Jan 20 20:45:52 2010 +0100
@@ -350,7 +350,6 @@
 def user_suspend(request, key):
     if request.method == 'POST':
         profile = get_object_or_404(UserProfile, key=key)
-        profile = UserProfile.objects.get(key=key)
         profile.is_suspended = True
         profile.save()
         if profile.user.is_active:            
@@ -369,7 +368,6 @@
 def user_enable(request, key):
     if request.method == 'POST':
         profile = get_object_or_404(UserProfile, key=key)
-        profile = UserProfile.objects.get(key=key)
         profile.is_suspended = False
         profile.save()
         if profile.user.is_active:
@@ -421,8 +419,6 @@
         role_field = self.fields['role']
         role_field.required = False
         role_field.choices = [(u'', u'---------')] + [(r.id, str(r)) for r in Role.objects.filter(anon=True)] # limit anon choices
-        for c in role_field.choices:
-            print c
         
         self.fields['role'] = role_field
 
@@ -444,7 +440,7 @@
 
 @has_global_perm('can_manage_workspace')    
 def user_edit(request, key):
-    profile = UserProfile.objects.get(key=key)
+    profile = get_object_or_404(UserProfile, key=key)
     user = profile.user
     userrole = profile.global_userrole()
     if request.method == 'POST':
@@ -481,7 +477,7 @@
 
 @login_required
 def user_contact(request, key):
-    recipient_profile = UserProfile.objects.get(key=key)
+    recipient_profile = get_object_or_404(UserProfile, key=key)
 
     if request.method == 'POST':
         contact_form = UserContactForm(request.POST)