Make all mixin methods ignore mg_globals and use self._app instead
This commit sponsored by Daniel Lang. Thank you!
This commit is contained in:
parent
7c563e91bf
commit
ddabf20f25
@ -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"]
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user