From ddabf20f256fc2eab97c72f0e9072ab784e0a904 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Wed, 3 Dec 2014 13:25:19 -0600 Subject: [PATCH] Make all mixin methods ignore mg_globals and use self._app instead This commit sponsored by Daniel Lang. Thank you! --- mediagoblin/db/mixin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py index 9b5c0e8e..e650ceb5 100644 --- a/mediagoblin/db/mixin.py +++ b/mediagoblin/db/mixin.py @@ -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"] ) -- 2.25.1