def check_exposure(self, request): if self.global_type: globals = b"" for (key, value) in self._get_metadata(request): if key == b"global": globals = value break if self.global_type not in parse_variants(globals): raise HTTPException(404, "This test cannot be loaded in %s mode" % self.global_type)
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_filesystem_path(request) try: with open(path, "rb") as f: yield from read_script_metadata(f, js_meta_re) except OSError: raise HTTPException(404)
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) try: with open(path, "rb") as f: for key, value in read_script_metadata(f, js_meta_re): yield key, value except IOError: raise HTTPException(404)