Edited the method used to clean link_id in params.py.
authorLennard de Rijk <ljvderijk@gmail.com>
Wed, 21 Jan 2009 14:36:44 +0000
changeset 867 f4ea0da41915
parent 866 6c918ceba37a
child 868 8d3c1ee6eba7
Edited the method used to clean link_id in params.py. Removed the clean_new_link_id from the logic/cleaning.py module because this is not used anymore. This method should be replaced by a method that is used after all the fields have been cleaned so that the actual key_name of an entity can be constructed. Patch by: Lennard de Rijk
app/soc/logic/cleaning.py
app/soc/views/helper/params.py
--- a/app/soc/logic/cleaning.py	Wed Jan 21 13:55:06 2009 +0000
+++ b/app/soc/logic/cleaning.py	Wed Jan 21 14:36:44 2009 +0000
@@ -29,26 +29,6 @@
 from soc.logic.models import user as user_logic
 
 
-def clean_new_link_id(logic):
-  """Clean method for new link_id's
-
-  Returns a clean method that checks if the specified link_id is
-  in the proper format, and verifies that the link_id is not already in
-  in use by another entity of the same type.
-  """
-
-  def wrapped(self):
-    # 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):
-      raise forms.ValidationError("This link ID is already in use.")
-    return link_id
-
-  return wrapped
-
-
 def clean_link_id(self):
   # convert to lowercase for user comfort
   link_id = self.cleaned_data.get('link_id').lower()
--- a/app/soc/views/helper/params.py	Wed Jan 21 13:55:06 2009 +0000
+++ b/app/soc/views/helper/params.py	Wed Jan 21 14:36:44 2009 +0000
@@ -64,8 +64,8 @@
       constructing the create_dynainclude value.
     extra_dynaexclude: The extra_dynaexclude value is used when
       constructing the create_dynaexclude value.
-    logic: The logic value is used as argument to clean_new_link_id
-      from the cleaning module.
+    logic: The logic value is used as argument to save the scope_logic
+      and create a create form.
   """
 
   logic = params['logic']
@@ -178,7 +178,7 @@
   new_params['dynabase'] = helper.forms.BaseForm
 
   create_dynafields = {
-      'clean_link_id': cleaning.clean_new_link_id(logic),
+      'clean_link_id': cleaning.clean_link_id,
       'clean_feed_url': cleaning.clean_feed_url,
       }
   create_dynafields.update(params.get('create_extra_dynafields', {}))