[extensions-web] upload: Delete versions (and possibly extensions) after a failed upload
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] upload: Delete versions (and possibly extensions) after a failed upload
- Date: Mon, 12 Dec 2011 17:38:03 +0000 (UTC)
commit e036076baa6765b7e4b2d03ae8329b8ad845c4e2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Dec 12 12:08:43 2011 -0500
upload: Delete versions (and possibly extensions) after a failed upload
parse_metadata_json needs to save the extension and the version to do its
thing. We need to delete the version if it's failed, and the extension as
well if it was created by this upload.
sweettooth/extensions/views.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index e07d953..68d68e0 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -307,8 +307,10 @@ def ajax_set_status_view(request, newstatus):
def upload_file(request, pk):
if pk is None:
extension = models.Extension(creator=request.user)
+ extension_is_new = True
else:
extension = models.Extension.objects.get(pk=pk)
+ extension_is_new = False
if extension.creator != request.user:
return HttpResponseForbidden()
@@ -360,6 +362,10 @@ def upload_file(request, pk):
else:
errors = e.messages
+ version.delete()
+ if extension_is_new:
+ extension.delete()
+
extra_debug = repr(e)
else:
is_valid = True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]