aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/mixin.py
diff options
context:
space:
mode:
authorRodney Ewing <ewing.rj@gmail.com>2013-07-01 17:19:22 -0700
committerRodney Ewing <ewing.rj@gmail.com>2013-07-02 07:21:44 -0700
commit58a947578cde02244c08268205e6855bee408c94 (patch)
treea5347202ffa596c23184474e362ef8d6db65564a /mediagoblin/db/mixin.py
parente9f3306627c106d6b3848deceb00cc321465b627 (diff)
downloadmediagoblin-58a947578cde02244c08268205e6855bee408c94.tar.lz
mediagoblin-58a947578cde02244c08268205e6855bee408c94.tar.xz
mediagoblin-58a947578cde02244c08268205e6855bee408c94.zip
modified gmg to use plugin media_types and converted image media_type to new plugin style
Diffstat (limited to 'mediagoblin/db/mixin.py')
-rw-r--r--mediagoblin/db/mixin.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py
index 1b32d838..2d878c80 100644
--- a/mediagoblin/db/mixin.py
+++ b/mediagoblin/db/mixin.py
@@ -29,15 +29,14 @@ real objects.
import uuid
import re
-import datetime
-
from datetime import datetime
from werkzeug.utils import cached_property
from mediagoblin import mg_globals
-from mediagoblin.media_types import get_media_managers, FileTypeNotSupported
+from mediagoblin.media_types import FileTypeNotSupported
from mediagoblin.tools import common, licenses
+from mediagoblin.tools.pluginapi import hook_handle
from mediagoblin.tools.text import cleaned_markdown_conversion
from mediagoblin.tools.url import slugify
@@ -204,14 +203,12 @@ class MediaEntryMixin(GenerateSlugMixin):
Raises FileTypeNotSupported in case no such manager is enabled
"""
- # TODO, we should be able to make this a simple lookup rather
- # than iterating through all media managers.
- for media_type, manager in get_media_managers():
- if media_type == self.media_type:
- return manager(self)
+ manager = hook_handle('get_media_manager', self.media_type)
+ if manager:
+ return manager
# Not found? Then raise an error
raise FileTypeNotSupported(
- "MediaManager not in enabled types. Check media_types in config?")
+ "MediaManager not in enabled types. Check media_types in config?")
def get_fail_exception(self):
"""