src/pyams_media/video.py
changeset 46 55d5fde71e8f
parent 37 96802026ce25
child 51 e96da5ef6539
--- a/src/pyams_media/video.py	Mon Sep 11 13:43:22 2017 +0200
+++ b/src/pyams_media/video.py	Mon Sep 11 13:44:23 2017 +0200
@@ -191,7 +191,7 @@
 
     @property
     def video_type(self):
-        return b'video/flash'
+        return 'video/flash'
 
 
 @adapter_config(name='video_type', context=(IVideo, Interface, Interface), provides=ITALESExtension)
@@ -202,8 +202,14 @@
         if context is None:
             context = self.context
         registry = self.request.registry
-        adapter = registry.queryAdapter(context, IVideoType, name=context.content_type.decode())
+        content_type = context.content_type
+        if isinstance(content_type, bytes):
+            content_type = content_type.decode()
+        adapter = registry.queryAdapter(context, IVideoType, name=content_type)
         if adapter is None:
             adapter = registry.queryAdapter(context, IVideoType)
         if adapter is not None:
-            return adapter.video_type.decode()
+            video_type = adapter.video_type
+            if isinstance(video_type, bytes):
+                video_type = video_type.decode()
+            return video_type