Make all mixin methods ignore mg_globals and use self._app instead
authorChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 3 Dec 2014 19:25:19 +0000 (13:25 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 3 Dec 2014 21:40:58 +0000 (15:40 -0600)
This commit sponsored by Daniel Lang.  Thank you!

mediagoblin/db/mixin.py

index 9b5c0e8e6ffb196bf3ba41f098a59b4138fd87cd..e650ceb54ae88246f8bd6db0e82237e1a9e7d278 100644 (file)
@@ -34,7 +34,6 @@ from datetime import datetime
 from pytz import UTC
 from werkzeug.utils import cached_property
 
-from mediagoblin import mg_globals
 from mediagoblin.media_types import FileTypeNotSupported
 from mediagoblin.tools import common, licenses
 from mediagoblin.tools.pluginapi import hook_handle
@@ -204,14 +203,14 @@ class MediaEntryMixin(GenerateSlugMixin):
         # TODO: implement generic fallback in case MEDIA_MANAGER does
         # not specify one?
         if u'thumb' in self.media_files:
-            thumb_url = mg_globals.app.public_store.file_url(
+            thumb_url = self._app.public_store.file_url(
                             self.media_files[u'thumb'])
         else:
             # No thumbnail in media available. Get the media's
             # MEDIA_MANAGER for the fallback icon and return static URL
             # Raises FileTypeNotSupported in case no such manager is enabled
             manager = self.media_manager
-            thumb_url = mg_globals.app.staticdirector(manager[u'default_thumb'])
+            thumb_url = self._app.staticdirector(manager[u'default_thumb'])
         return thumb_url
 
     @property
@@ -221,7 +220,7 @@ class MediaEntryMixin(GenerateSlugMixin):
         if u"original" not in self.media_files:
             return self.thumb_url
 
-        return mg_globals.app.public_store.file_url(
+        return self._app.public_store.file_url(
             self.media_files[u"original"]
             )