From a45dee02e419d2ed1b9b3316d24ccea43a2c5571 Mon Sep 17 00:00:00 2001
From: Emily O'Leary <lotusecho@ThinkLotus>
Date: Sun, 24 Mar 2013 23:43:45 -0400
Subject: [PATCH 1/2] Moved where the slug was being generated to the end of
the task so that if it fails before then no slug is
created for it.
---
mediagoblin/processing/task.py | 2 ++
mediagoblin/submit/views.py | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py
index 9af192e..2a8b0bc 100644
|
a
|
b
|
class ProcessMedia(task.Task):
|
| 94 | 94 | # We set the state to processed and save the entry here so there's |
| 95 | 95 | # no need to save at the end of the processing stage, probably ;) |
| 96 | 96 | entry.state = u'processed' |
| | 97 | #Generate the slug here rather than earlier when it could have failed. |
| | 98 | entry.generate_slug() |
| 97 | 99 | entry.save() |
| 98 | 100 | |
| 99 | 101 | # Notify the PuSH servers as async task |
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index 3f9d5b2..b2629bb 100644
|
a
|
b
|
def submit_start(request):
|
| 78 | 78 | entry.tags = convert_to_tag_list_of_dicts( |
| 79 | 79 | submit_form.tags.data) |
| 80 | 80 | |
| 81 | | # Generate a slug from the title |
| 82 | | entry.generate_slug() |
| 83 | | |
| 84 | 81 | queue_file = prepare_queue_task(request.app, entry, filename) |
| 85 | 82 | |
| 86 | 83 | with queue_file: |
--
1.7.10.4
From 8b25f7139bdd8180947fe36dba0cebf80b94c74f Mon Sep 17 00:00:00 2001
From: Emily O'Leary <Emma.C.Echo@gmail.com>
Date: Tue, 6 Aug 2013 16:31:30 -0400
Subject: [PATCH 2/2] Rebased with current master. Replaced tabs with four
spaces in task.py. Removed generate_slug() from
plugins/api/views.py.
---
mediagoblin/plugins/api/views.py | 2 --
mediagoblin/processing/task.py | 4 ++--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/mediagoblin/plugins/api/views.py b/mediagoblin/plugins/api/views.py
index 9159fe6..0e8735b 100644
|
a
|
b
|
def post_entry(request):
|
| 61 | 61 | entry.description = unicode(request.form.get('description')) |
| 62 | 62 | entry.license = unicode(request.form.get('license', '')) |
| 63 | 63 | |
| 64 | | entry.generate_slug() |
| 65 | | |
| 66 | 64 | # queue appropriately |
| 67 | 65 | queue_file = prepare_queue_task(request.app, entry, media_file.filename) |
| 68 | 66 | |
diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py
index 2a8b0bc..ba2323b 100644
|
a
|
b
|
class ProcessMedia(task.Task):
|
| 94 | 94 | # We set the state to processed and save the entry here so there's |
| 95 | 95 | # no need to save at the end of the processing stage, probably ;) |
| 96 | 96 | entry.state = u'processed' |
| 97 | | #Generate the slug here rather than earlier when it could have failed. |
| 98 | | entry.generate_slug() |
| | 97 | #Generate the slug here rather than earlier when it could have failed. |
| | 98 | entry.generate_slug() |
| 99 | 99 | entry.save() |
| 100 | 100 | |
| 101 | 101 | # Notify the PuSH servers as async task |