Revert "Leave slug empty until we are sure media processing was successful."
authorRodney Ewing <ewing.rj@gmail.com>
Thu, 8 Aug 2013 22:49:33 +0000 (15:49 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Thu, 8 Aug 2013 22:49:33 +0000 (15:49 -0700)
This reverts commit f67611fb485b5a84cedc62b73beb1e551e8cb934.

For some reason, generating a slug here throws an integrity error during
a query when there is a duplicate slug.

mediagoblin/plugins/api/views.py
mediagoblin/processing/task.py
mediagoblin/submit/views.py

index 0e8735bcbfacc4646f872f01be26c40abf565b4f..9159fe65bf0a580b1869fa30ce8e67c7edec5704 100644 (file)
@@ -61,6 +61,8 @@ def post_entry(request):
     entry.description = unicode(request.form.get('description'))
     entry.license = unicode(request.form.get('license', ''))
 
+    entry.generate_slug()
+
     # queue appropriately
     queue_file = prepare_queue_task(request.app, entry, media_file.filename)
 
index ba2323b29bd5e5ea9408c62ca86b3d5f24e54239..9af192edb97f0f902dc15b253c1918dcae40cd40 100644 (file)
@@ -94,8 +94,6 @@ class ProcessMedia(task.Task):
             # We set the state to processed and save the entry here so there's
             # no need to save at the end of the processing stage, probably ;)
             entry.state = u'processed'
-            #Generate the slug here rather than earlier when it could have failed.
-            entry.generate_slug()
             entry.save()
 
             # Notify the PuSH servers as async task
index b2629bb5cab2e3d83a6389fa3cc388c01538d040..3f9d5b2df2ac0adf654934d52cb4e8075586ffa7 100644 (file)
@@ -78,6 +78,9 @@ def submit_start(request):
                 entry.tags = convert_to_tag_list_of_dicts(
                     submit_form.tags.data)
 
+                # Generate a slug from the title
+                entry.generate_slug()
+
                 queue_file = prepare_queue_task(request.app, entry, filename)
 
                 with queue_file: