def css_bundle(self, xmlid, version=None, **kw): try: bundle = AssetsBundle(xmlid) except QWebTemplateNotFound: return request.not_found() response = request.make_response(bundle.css(), [('Content-Type', 'text/css')]) return make_conditional(response, bundle.last_modified, max_age=BUNDLE_MAXAGE)
def css_bundle(self, xmlid, version=None, page=None, **kw): try: bundle = AssetsBundle(xmlid) except QWebTemplateNotFound: return request.not_found() e_tag = request.httprequest.headers.get('If-None-Match') if e_tag and e_tag == bundle.checksum: return werkzeug.wrappers.Response(status=304) else: response = request.make_response(bundle.css(page), [('Content-Type', 'text/css')]) return make_conditional(response, bundle.last_modified, etag=bundle.checksum, max_age=BUNDLE_MAXAGE)
def qweb(self, mods=None, db=None): files = [f[0] for f in controllers_main.manifest_glob('qweb', addons=mods, db=db)] last_modified = controllers_main.get_last_modified(files) if request.httprequest.if_modified_since and request.httprequest.if_modified_since >= last_modified: return controllers_main.werkzeug.wrappers.Response(status=304) content, checksum = controllers_main.concat_xml(files) if request.context['lang'] == 'en_US': content = content.decode('utf-8') content = request.env['ir.translation']._debrand(content) return controllers_main.make_conditional( request.make_response(content, [('Content-Type', 'text/xml')]), last_modified, checksum)
def qweb(self, mods=None, db=None): files = [f[0] for f in controllers_main.manifest_glob('qweb', addons=mods, db=db)] last_modified = controllers_main.get_last_modified(files) if request.httprequest.if_modified_since and request.httprequest.if_modified_since >= last_modified: return controllers_main.werkzeug.wrappers.Response(status=304) content, checksum = controllers_main.concat_xml(files) if request.context['lang'] == 'en_US': content = content.decode('utf-8') content = self._debrand(content) return controllers_main.make_conditional( request.make_response(content, [('Content-Type', 'text/xml')]), last_modified, checksum)