def luminosTemplates(url): path = url.path()[1:] if path: path = "templates" + os.sep.join(path.split("/")) return "text/html", utils.readResourceFile(path, binary=False) else: raise UrlInvalidError("No file specified")
def luminosCss(url): path = url.path() if path: path = "css" + os.sep.join(path.split("/")) return "text/css", utils.readResourceFile(path, binary=False) else: raise UrlInvalidError("No file specified")
def luminosJavascript(url): """Handler for luminos://javascript. Return content of file given as query parameter. """ path = url.path()[1:] if path: path = "javascript" + os.sep.join(path.split("/")) return "text/javascript", utils.readResourceFile(path, binary=False) else: raise UrlInvalidError("No file specified")
def test_readfile_binary(self, testfile): """Read a test file in binary mode.""" content = utils.readResourceFile('testfile', binary=True) assert content.splitlines()[0] == b"Hello World!"
def test_readfile(self, testfile): """Read a test file.""" content = utils.readResourceFile('testfile') assert content.splitlines()[0] == "Hello World!"