--- a/app/soc/logic/cleaning.py Fri Jan 30 20:16:53 2009 +0000
+++ b/app/soc/logic/cleaning.py Fri Jan 30 21:58:31 2009 +0000
@@ -35,7 +35,7 @@
def clean_link_id(field_name):
- """Checks if the field_name value is in a valid link ID format.
+ """Checks if the field_name value is in a valid link ID format.
"""
def wrapper(self):
# convert to lowercase for user comfort
@@ -46,6 +46,18 @@
return wrapper
+def clean_scope_path(field_name):
+ """Checks if the field_name value is in a valid scope path format.
+ """
+ def wrapper(self):
+ # convert to lowercase for user comfort
+ scope_path = self.cleaned_data.get(field_name).lower()
+ if not validate.isScopePathFormatValid(scope_path):
+ raise forms.ValidationError("This scope path is in wrong format.")
+ return scope_path
+ return wrapper
+
+
def clean_agrees_to_tos(field_name):
"""Checks if there is a ToS to see if it is allowed to leave
the field_name field false.