Changed clean_link_id to convert the input to lower characters for user comfort.
authorLennard de Rijk <ljvderijk@gmail.com>
Tue, 02 Dec 2008 20:14:14 +0000
changeset 650 33b6dcae5615
parent 649 95a41542e693
child 651 ef6e22d463cb
Changed clean_link_id to convert the input to lower characters for user comfort. It has been changed in a couple of files, most importantly in logic/cleaning.py wich will be used by future forms to do their cleaning. Patch by: Lennard de Rijk
app/soc/logic/cleaning.py
app/soc/views/models/document.py
app/soc/views/models/user.py
app/soc/views/models/user_self.py
--- a/app/soc/logic/cleaning.py	Tue Dec 02 20:10:23 2008 +0000
+++ b/app/soc/logic/cleaning.py	Tue Dec 02 20:14:14 2008 +0000
@@ -37,7 +37,8 @@
   """
 
   def wrapped(self):
-    link_id = self.cleaned_data.get('link_id')
+    # convert to lowercase for user comfort
+    link_id = self.cleaned_data.get('link_id').lower()
     if not validate.isLinkIdFormatValid(link_id):
       raise forms.ValidationError("This link ID is in wrong format.")
     if logic.getFromFields(link_id=link_id):
@@ -48,7 +49,8 @@
 
 
 def clean_link_id(self):
-  link_id = self.cleaned_data.get('link_id')
+  # convert to lowercase for user comfort
+  link_id = self.cleaned_data.get('link_id').lower()
   if not validate.isLinkIdFormatValid(link_id):
     raise forms.ValidationError("This link ID is in wrong format.")
   return link_id
--- a/app/soc/views/models/document.py	Tue Dec 02 20:10:23 2008 +0000
+++ b/app/soc/views/models/document.py	Tue Dec 02 20:14:14 2008 +0000
@@ -63,7 +63,7 @@
     return scope_path
 
   def clean_link_id(self):
-    link_id = self.cleaned_data.get('link_id')
+    link_id = self.cleaned_data.get('link_id').lower()
     # TODO(tlarsen): combine path and link_id and check for uniqueness
     if not validate.isLinkIdFormatValid(link_id):
       raise forms.ValidationError("This link ID is in wrong format.")
--- a/app/soc/views/models/user.py	Tue Dec 02 20:10:23 2008 +0000
+++ b/app/soc/views/models/user.py	Tue Dec 02 20:14:14 2008 +0000
@@ -65,7 +65,7 @@
     model = None
 
   def clean_link_id(self):
-    link_id = self.cleaned_data.get('link_id')
+    link_id = self.cleaned_data.get('link_id').lower()
     if not validate.isLinkIdFormatValid(link_id):
       raise forms.ValidationError("This link ID is in wrong format.")
 
--- a/app/soc/views/models/user_self.py	Tue Dec 02 20:10:23 2008 +0000
+++ b/app/soc/views/models/user_self.py	Tue Dec 02 20:14:14 2008 +0000
@@ -55,7 +55,7 @@
     exclude = ['account', 'former_accounts', 'is_developer']
 
   def clean_link_id(self):
-    link_id = self.cleaned_data.get('link_id')
+    link_id = self.cleaned_data.get('link_id').lower()
     if not validate.isLinkIdFormatValid(link_id):
       raise forms.ValidationError("This link ID is in wrong format.")