Optionally return link_id in clean_user_is_current
authorSverre Rabbelier <srabbelier@gmail.com>
Sun, 22 Mar 2009 14:52:05 +0000
changeset 1985 4ff03ca639fd
parent 1984 eb02fd5427c5
child 1986 5375e657a715
Optionally return link_id in clean_user_is_current Patch by: Sverre Rabbelier
app/soc/logic/cleaning.py
--- a/app/soc/logic/cleaning.py	Sun Mar 22 14:51:37 2009 +0000
+++ b/app/soc/logic/cleaning.py	Sun Mar 22 14:52:05 2009 +0000
@@ -172,7 +172,7 @@
   return wrapped
 
 
-def clean_user_is_current(field_name):
+def clean_user_is_current(field_name, as_user=True):
   """Check if the field_name value is a valid link_id and resembles the
      current user.
   """
@@ -189,7 +189,7 @@
       # this user is not the current user
       raise forms.ValidationError("This user is not you.")
 
-    return user_entity
+    return user_entity if as_user else link_id
   return wrapped