From 6c50c2106816c920ef404dea641a8eac8c5914eb Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 13 Aug 2011 07:48:34 -0500 Subject: [PATCH] Add fail_error and fail_metadata fields to MediaEntry and relevant migration --- mediagoblin/db/migrations.py | 17 +++++++++++++++++ mediagoblin/db/models.py | 10 +++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 171b5c83..5456b248 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -75,3 +75,20 @@ def mediaentry_add_queued_task_id(database): {'queued_task_id': {'$exists': False}}, {'$set': {'queued_task_id': None}}, multi=True) + + +@RegisterMigration(5) +def mediaentry_add_fail_error_and_metadata(database): + """ + Add 'fail_error' and 'fail_metadata' fields to media entries + """ + collection = database['media_entries'] + collection.update( + {'fail_error': {'$exists': False}}, + {'$set': {'fail_error': None}}, + multi=True) + + collection.update( + {'fail_metadata': {'$exists': False}}, + {'$set': {'fail_metadata': {}}}, + multi=True) diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 0dcb6ce8..982883d7 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -171,6 +171,9 @@ class MediaEntry(Document): - attachment_files: A list of "attachment" files, ones that aren't critical to this piece of media but may be usefully relevant to people viewing the work. (currently unused.) + + - fail_error: path to the exception raised + - fail_metadata: """ __collection__ = 'media_entries' @@ -197,7 +200,12 @@ class MediaEntry(Document): # The following should be lists of lists, in appropriate file # record form - 'attachment_files': list} + 'attachment_files': list, + + # If things go badly in processing things, we'll store that + # data here + 'fail_error': unicode, + 'fail_metadata': dict} required_fields = [ 'uploader', 'created', 'media_type', 'slug'] -- 2.25.1