From: Christopher Allan Webber Date: Sun, 14 Aug 2011 12:55:08 +0000 (-0500) Subject: Method to get the failure exception object for a MediaEntry, if appropriate. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6ee9c719025f954bfc996f11b4a89219f635a17f;p=mediagoblin.git Method to get the failure exception object for a MediaEntry, if appropriate. --- diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 982883d7..b6e52441 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -297,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): """