From f67611fb485b5a84cedc62b73beb1e551e8cb934 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Wed, 7 Aug 2013 16:15:27 -0700 Subject: [PATCH] Leave slug empty until we are sure media processing was successful. Patch submitted by LotusEcho --- mediagoblin/plugins/api/views.py | 2 -- mediagoblin/processing/task.py | 2 ++ mediagoblin/submit/views.py | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/mediagoblin/plugins/api/views.py b/mediagoblin/plugins/api/views.py index 9159fe65..0e8735bc 100644 --- a/mediagoblin/plugins/api/views.py +++ b/mediagoblin/plugins/api/views.py @@ -61,8 +61,6 @@ 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) diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py index 9af192ed..ba2323b2 100644 --- a/mediagoblin/processing/task.py +++ b/mediagoblin/processing/task.py @@ -94,6 +94,8 @@ 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 diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index 3f9d5b2d..b2629bb5 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -78,9 +78,6 @@ 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: -- 2.25.1