def get_context(self, url, context): c = { 'url': url, 'parameters': dict((key, context[key]) for key in self.supported_parameters if key in context) } if 'mime_type' in context: c['mime_type'] = normalize_mimetype(context['mime_type']) return c
def get_context(self, url, context): c = super(FileEmbedGenerator, self).get_context(url, context) mime_type = context.get('mime_type') if not mime_type: mime_type = mimetypes.guess_type(url, strict=False)[0] mime_type = normalize_mimetype(mime_type) c['mime_type'] = mime_type if mime_type in QUICKTIME_MIMETYPES: c['fallback_template'] = 'djvideo/files/quicktime.html' elif mime_type in FLASH_MIMETYPES: c['fallback_template'] = 'djvideo/files/flash.html' else: c['fallback_template'] = 'djvideo/files/default.html' return c
def get_context(self, url, context): c = super(FileEmbedGenerator, self).get_context(url, context) mime_type = context.get("mime_type") if not mime_type: mime_type = mimetypes.guess_type(url, strict=False)[0] mime_type = normalize_mimetype(mime_type) c["mime_type"] = mime_type if mime_type in QUICKTIME_MIMETYPES: c["fallback_template"] = "djvideo/files/quicktime.html" elif mime_type in FLASH_MIMETYPES: c["fallback_template"] = "djvideo/files/flash.html" else: c["fallback_template"] = "djvideo/files/default.html" return c
def get_context(self, url, context): c = {"url": url, "parameters": dict((key, context[key]) for key in self.supported_parameters if key in context)} if "mime_type" in context: c["mime_type"] = normalize_mimetype(context["mime_type"]) return c