Fix unit tests with new license support
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Sat, 21 Jan 2012 18:24:36 +0000 (19:24 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Sat, 21 Jan 2012 18:24:36 +0000 (19:24 +0100)
Make the license field in the forms optional and let them
properly be defaulted to "".

mediagoblin/edit/forms.py
mediagoblin/edit/views.py
mediagoblin/submit/forms.py
mediagoblin/submit/views.py

index d49b9b28578d411f464a15db5ad7b8b7d71ecfdf..3e3612fedfc276a58793409e93270a84a7092a10 100644 (file)
@@ -42,6 +42,7 @@ class EditForm(wtforms.Form):
             "You usually don't need to change this."))
     license = wtforms.SelectField(
         _('License'),
+        [wtforms.validators.Optional(),],
         choices=licenses_as_choices())
 
 class EditProfileForm(wtforms.Form):
index cffb8a3c61a3800e42f3bdbb2899dbbdbc0310b5..62684dcf6cbc9982ca13e3cac37d9e88308bd1fe 100644 (file)
@@ -75,9 +75,7 @@ def edit_media(request, media):
             media.description_html = cleaned_markdown_conversion(
                 media.description)
 
-            media.license = (
-                unicode(request.POST.get('license'))
-                or '')
+            media.license = unicode(request.POST.get('license', ''))
 
             media.slug = unicode(request.POST['slug'])
 
index 4ff52609130656499b0b8a7ea03608eaee4379d1..1ff59c18cbc44a588c0ca86262ca8d9e66429952 100644 (file)
@@ -39,4 +39,5 @@ class SubmitStartForm(wtforms.Form):
           "Separate tags by commas."))
     license = wtforms.SelectField(
         _('License'),
+        [wtforms.validators.Optional(),],
         choices=licenses_as_choices())
index 8911bf8286d8401085925c579ebc2a36c55c2aa3..832203a49103753f40eaa253104b8573be9dd659 100644 (file)
@@ -69,9 +69,7 @@ def submit_start(request):
                 entry.description_html = cleaned_markdown_conversion(
                     entry.description)
 
-                entry.license = (
-                    unicode(request.POST.get('license'))
-                    or '')
+                entry.license = unicode(request.POST.get('license', ''))
 
                 entry.uploader = request.user._id