def _get_meta(self, request): path = filesystem_path(self.base_path, request, self.url_base) path = path.replace(".any.worker.html", ".any.js") path = path.replace(".worker.html", ".worker.js") with open(path, "rb") as f: for key, value in read_script_metadata(f, js_meta_re): if key == b"timeout": if value == b"long": yield '<meta name="timeout" content="long">'
def _get_meta(self, request): path = filesystem_path(self.base_path, request, self.url_base) path = path.replace(".any.worker.html", ".any.js") path = path.replace(".worker.html", ".worker.js") with open(path, "rb") as f: for key, value in read_script_metadata(f): if key == b"timeout": if value == b"long": yield '<meta name="timeout" content="long">'
def _get_metadata(self, request): """Get an iterator over script metadata based on //META comments in the associated js file. :param request: The Request being processed. """ path = self._get_path(filesystem_path(self.base_path, request, self.url_base), False) with open(path, "rb") as f: for key, value in read_script_metadata(f, js_meta_re): yield key, value
def _get_meta(self, request): path = filesystem_path(self.base_path, request, self.url_base) path = path.replace(".any.worker.js", ".any.js") with open(path, "rb") as f: for key, value in read_script_metadata(f): if key == b"timeout": pass elif key == b"script": attribute = value.decode('utf-8').replace("\\", "\\\\").replace('"', '\\"') yield 'importScripts("%s")' % attribute
def _get_meta(self, request): path = filesystem_path(self.base_path, request, self.url_base) path = path.replace(".any.html", ".any.js") with open(path, "rb") as f: for key, value in read_script_metadata(f): if key == b"timeout": if value == b"long": yield '<meta name="timeout" content="long">' elif key == b"script": attribute = value.decode('utf-8').replace('"', """).replace(">", ">") yield '<script src="%s"></script>' % attribute
def _get_meta(self, request): """Get an iterator over strings to inject into the wrapper document based on //META comments in the associated js file. :param request: The Request being processed. """ path = self._get_path(filesystem_path(self.base_path, request, self.url_base), False) with open(path, "rb") as f: for key, value in read_script_metadata(f, js_meta_re): replacement = self._meta_replacement(key, value) if replacement: yield replacement
def _get_meta(self, request): """Get an iterator over strings to inject into the wrapper document based on //META comments in the associated js file. :param request: The Request being processed. """ path = self._get_path(filesystem_path(self.base_path, request, self.url_base), False) with open(path, "rb") as f: for key, value in read_script_metadata(f, js_meta_re): replacement = self._meta_replacement(key, value) if replacement: yield replacement
def _get_meta(self, request): path = filesystem_path(self.base_path, request, self.url_base) path = path.replace(".any.worker.js", ".any.js") with open(path, "rb") as f: for key, value in read_script_metadata(f, js_meta_re): if key == b"timeout": pass elif key == b"script": attribute = value.decode('utf-8').replace("\\", "\\\\").replace( '"', '\\"') yield 'importScripts("%s")' % attribute
def _get_meta(self, request): path = filesystem_path(self.base_path, request, self.url_base) path = path.replace(".any.html", ".any.js") with open(path, "rb") as f: for key, value in read_script_metadata(f, js_meta_re): if key == b"timeout": if value == b"long": yield '<meta name="timeout" content="long">' elif key == b"script": attribute = value.decode('utf-8').replace( '"', """).replace(">", ">") yield '<script src="%s"></script>' % attribute
def _get_meta(self, request): path = filesystem_path(self.base_path, request, self.url_base) path = path.replace(".worker.html", ".worker.js") meta_values = [] with open(path) as f: for line in f: m = meta_re.match(line) if m: name, content = m.groups() name = name.replace('"', '\\"').replace(">", ">") content = content.replace('"', '\\"').replace(">", ">") meta_values.append((name, content)) return "\n".join('<meta name="%s" content="%s">' % item for item in meta_values)
def _get_meta(self, request): path = filesystem_path(self.base_path, request, self.url_base) path = path.replace(".worker", ".worker.js") meta_values = [] with open(path) as f: for line in f: m = meta_re.match(line) if m: name, content = m.groups() name = name.replace('"', '\\"').replace(">", ">") content = content.replace('"', '\\"').replace(">", ">") meta_values.append((name, content)) return "\n".join('<meta name="%s" content="%s">' % item for item in meta_values)
def _get_filesystem_path(self, request): """Get the path of the underlying resource file on disk.""" return self._get_path(filesystem_path(self.base_path, request, self.url_base), False)