Add a regular 'empty field cleaner'
authorSverre Rabbelier <srabbelier@gmail.com>
Thu, 19 Feb 2009 19:56:24 +0000
changeset 1395 08dbb5aa1dc9
parent 1394 fe00de66f4e6
child 1396 2238f2af7428
Add a regular 'empty field cleaner' Regular, as opposed to a decorator. Patch by: Sverre Rabbelier
app/soc/logic/cleaning.py
--- a/app/soc/logic/cleaning.py	Thu Feb 19 18:37:44 2009 +0000
+++ b/app/soc/logic/cleaning.py	Thu Feb 19 19:56:24 2009 +0000
@@ -70,6 +70,17 @@
   return decorator
 
 
+def clean_empty_field(field_name):
+  """Incorperates the check_field_is_empty as regular cleaner.
+  """
+
+  @check_field_is_empty(field_name)
+  def wrapper(self):
+    return self.cleaned_data.get(field_name)
+
+  return wrapper
+
+
 def clean_link_id(field_name):
   """Checks if the field_name value is in a valid link ID format.
   """