Method to get the failure exception object for a MediaEntry, if appropriate.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 14 Aug 2011 12:55:08 +0000 (07:55 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 14 Aug 2011 12:55:08 +0000 (07:55 -0500)
mediagoblin/db/models.py

index 982883d758484c6f78aa2b909adb3cc4bc0f372c..b6e52441e644188380ca95a2ed2405b541c1c075 100644 (file)
@@ -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):
     """