Add fail_error and fail_metadata fields to MediaEntry and relevant migration

This commit is contained in:
Christopher Allan Webber 2011-08-13 07:48:34 -05:00
parent 4b860cb823
commit 6c50c21068
2 changed files with 26 additions and 1 deletions

View File

@ -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)

View File

@ -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']