def render(self, context): rendered_contents = self.nodelist.render(context) css = '' for expression in self.filter_expressions: path = expression.resolve(context, True) expanded_path = finders.find(path) with open(expanded_path) as css_file: css = ''.join((css, css_file.read())) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()
def render(self, context): rendered_contents = self.nodelist.render(context) css = '' for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_text(path) css = ''.join((css, find(path))) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()
def render(self, context): rendered_contents = self.nodelist.render(context) css = '' for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_unicode(path) expanded_path = full_path(path) with open(expanded_path) as css_file: css = ''.join((css, css_file.read())) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()
def render(self, context): rendered_contents = self.nodelist.render(context) css = '' for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_text(path) # NOTE: Different from release version of django-inline.css expanded_path = finders.find(path) with open(expanded_path) as css_file: css = ''.join((css, css_file.read())) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()
def render(self, context): rendered_contents = self.nodelist.render(context) css = '' for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_unicode(path) if settings.DEBUG or getattr(settings, 'INLINECSS_USE_FINDERS', False): expanded_path = finders.find(path) else: expanded_path = staticfiles_storage.path(path) with open(expanded_path) as css_file: css = ''.join((css, css_file.read())) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()
def render(self, context): rendered_contents = self.nodelist.render(context) css = '' for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_unicode(path) if settings.DEBUG: expanded_path = finders.find(path) else: expanded_path = staticfiles_storage.path(path) with open(expanded_path) as css_file: css = ''.join((css, css_file.read())) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()
def render(self, context): rendered_contents = self.nodelist.render(context) css = '' for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_text(path) css = '' if not issubclass(staticfiles_storage.__class__, FileSystemStorage): with urlopen(staticfiles_storage.url(path)) as css_file: css = ''.join((css, css_file.read().decode('utf-8'))) else: with open(staticfiles_storage.path(path)) as css_file: css = ''.join((css, css_file.read())) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()
def render(self, context): rendered_contents = self.nodelist.render(context) css = '' for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_unicode(path) if settings.DEBUG or not getattr( settings, 'INLINECSS_USE_STATIC_FINDER', False): expanded_path = finders.find(path) css_file = open(expanded_path) else: css_file = staticfiles_storage.open(path) with css_file: css = ''.join((css, css_file.read())) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()
def render(self, context): rendered_contents = self.nodelist.render(context) css = "" for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_unicode(path) try: if settings.DEBUG: expanded_path = finders.find(path) else: expanded_path = staticfiles_storage.path(path) with open(expanded_path) as css_file: css = "".join((css, css_file.read())) except NotImplementedError: css = "".join((css, staticfiles_storage.open(path).read())) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render()