Turning image's media manager into a new style class.
images are the first media type to use the new style class based media manager.
This commit is contained in:
parent
95dab599da
commit
f84425c0c1
@ -14,19 +14,19 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from mediagoblin.media_types import MediaManagerBase
|
||||||
from mediagoblin.media_types.image.processing import process_image, \
|
from mediagoblin.media_types.image.processing import process_image, \
|
||||||
sniff_handler
|
sniff_handler
|
||||||
|
|
||||||
|
|
||||||
MEDIA_MANAGER = {
|
class ImageMediaManager(MediaManagerBase):
|
||||||
"human_readable": "Image",
|
human_readable = "Image"
|
||||||
"processor": process_image, # alternately a string,
|
processor = staticmethod(process_image)
|
||||||
# 'mediagoblin.media_types.image.processing'?
|
sniff_handler = staticmethod(sniff_handler)
|
||||||
"sniff_handler": sniff_handler,
|
display_template = "mediagoblin/media_displays/image.html"
|
||||||
"display_template": "mediagoblin/media_displays/image.html",
|
default_thumb = "images/media_thumbs/image.png"
|
||||||
"default_thumb": "images/media_thumbs/image.png",
|
accepted_extensions = ["jpg", "jpeg", "png", "gif", "tiff"]
|
||||||
"accepted_extensions": ["jpg", "jpeg", "png", "gif", "tiff"],
|
media_fetch_order = [u'medium', u'original', u'thumb']
|
||||||
|
|
||||||
# Used by the media_entry.get_display_media method
|
|
||||||
"media_fetch_order": [u'medium', u'original', u'thumb'],
|
MEDIA_MANAGER = ImageMediaManager
|
||||||
}
|
|
||||||
|
@ -231,7 +231,7 @@ class TestSubmission:
|
|||||||
media = self.check_media(request, {'title': u'Balanced Goblin'}, 1)
|
media = self.check_media(request, {'title': u'Balanced Goblin'}, 1)
|
||||||
|
|
||||||
assert media.media_type == u'mediagoblin.media_types.image'
|
assert media.media_type == u'mediagoblin.media_types.image'
|
||||||
assert media.media_manager.mm_dict == img_MEDIA_MANAGER
|
assert isinstance(media.media_manager, img_MEDIA_MANAGER)
|
||||||
assert media.media_manager.entry == media
|
assert media.media_manager.entry == media
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user