def _replace_image_loader(swf_name, replace_images, animation_type, is_redberry=False): """ Flash埋め込み用画像を読み込む replace_images = {'key': instance of Image} ==> {'key': raw_data} """ if not replace_images: return {} result = {} for key, image in replace_images.items(): if isinstance(image, (Image, Image2)): object_key = get_animation_param_name(swf_name, animation_type, key) if object_key: if animation_type in ["swf", "reel"]: result[object_key] = image.media if animation_type in ["html"]: if is_redberry: if isinstance(image, Image): result[object_key] = get_device_name() + "/" + image.path elif isinstance(image, Image2): result[object_key] = image.reactive_path else: result[object_key] = image.url if not image.is_exists and not getattr(image, "dummy_image", None): raise ImageDoesNotExist(image.url) return result
def _replace_image_loader(swf_name, replace_images, animation_type, is_redberry=False): """ Flash埋め込み用画像を読み込む replace_images = {'key': instance of Image} ==> {'key': raw_data} """ if not replace_images: return {} result = {} for key, image in replace_images.items(): if isinstance(image, (Image, Image2)): object_key = get_animation_param_name(swf_name, animation_type, key) if object_key: if animation_type in ['swf', 'reel']: result[object_key] = image.media if animation_type in ['html']: if is_redberry: if isinstance(image, Image): result[object_key] = \ get_device_name() + '/' + image.path elif isinstance(image, Image2): result[object_key] = image.reactive_path else: result[object_key] = image.url if not image.is_exists and not getattr( image, 'dummy_image', None): raise ImageDoesNotExist(image.url) return result
def get(self, request, *args, **kwargs): path = kwargs.get("path").split("/") filename = path.pop(-1) path = os.path.join(MOCK_BASE_PATH, get_device_name(request.device.is_featurephone), *path) t, origin = loader.find_template(filename, [path]) context = {"card": ObjectMock(pk=33), "player_card": ObjectMock(pk=33), "player": ObjectMock(pk=str(33))} context.update(get_template_article_keys(os.path.join(path, filename))) return HttpResponse(t.render(RequestContext(request, context)))
def get(self, request, *args, **kwargs): path = kwargs.get('path').split('/') filename = path.pop(-1) path = os.path.join(MOCK_BASE_PATH, get_device_name(request.device.is_featurephone), *path) t, origin = loader.find_template(filename, [path]) context = { 'card': ObjectMock(pk=33), 'player_card': ObjectMock(pk=33), 'player': ObjectMock(pk=str(33)) } context.update(get_template_article_keys(os.path.join(path, filename))) return HttpResponse(t.render(RequestContext(request, context)))