From: Elrond Date: Sat, 21 Jan 2012 18:24:36 +0000 (+0100) Subject: Fix unit tests with new license support X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3c351460e1dbed9e789e363f1d5635160bce8d84;p=mediagoblin.git Fix unit tests with new license support Make the license field in the forms optional and let them properly be defaulted to "". --- diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py index d49b9b28..3e3612fe 100644 --- a/mediagoblin/edit/forms.py +++ b/mediagoblin/edit/forms.py @@ -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): diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index cffb8a3c..62684dcf 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -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']) diff --git a/mediagoblin/submit/forms.py b/mediagoblin/submit/forms.py index 4ff52609..1ff59c18 100644 --- a/mediagoblin/submit/forms.py +++ b/mediagoblin/submit/forms.py @@ -39,4 +39,5 @@ class SubmitStartForm(wtforms.Form): "Separate tags by commas.")) license = wtforms.SelectField( _('License'), + [wtforms.validators.Optional(),], choices=licenses_as_choices()) diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index 8911bf82..832203a4 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -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