aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r--mediagoblin/db/models.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index aff2a65b..b6e52441 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -162,6 +162,8 @@ class MediaEntry(Document):
queued for processing. This is stored in the mg_globals.queue_store
storage system.
+ - queued_task_id: celery task id. Use this to fetch the task state.
+
- media_files: Files relevant to this that have actually been processed
and are available for various types of display. Stored like:
{'thumb': ['dir1', 'dir2', 'pic.png'}
@@ -169,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'
@@ -188,13 +193,19 @@ class MediaEntry(Document):
# For now let's assume there can only be one main file queued
# at a time
'queued_media_file': [unicode],
+ 'queued_task_id': unicode,
# A dictionary of logical names to filepaths
'media_files': dict,
# 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']
@@ -286,6 +297,13 @@ class MediaEntry(Document):
def uploader(self):
return self.db.User.find_one({'_id': self['uploader']})
+ def get_fail_exception(self):
+ """
+ Get the exception that's appropriate for this error
+ """
+ if self['fail_error']:
+ return util.import_component(self['fail_error'])
+
class MediaComment(Document):
"""