def parse_file(cls, filename): """Parse from a file""" file_url = filename_to_url(filename) tree = parse(filename, base_url=file_url) el = tree.getroot() tree.xinclude() return cls.parse_xml(el, file_url, traverse=True)
def parse_file(cls, filename): """Parse from a file""" file_url = filename_to_url(filename) file = open(filename) tree = parse(file, base_url=file_url) file.close() el = tree.getroot() tree.xinclude() return cls.parse_xml(el, file_url, traverse=True)
def parse_file(cls, filename): """Parse this from a filname""" file_url = filename_to_url(filename) file = open(filename) tree = parse(file, base_url=file_url) file.close() el = tree.getroot() tree.xinclude() return cls.parse_xml(el, file_url)
def parse_file(cls, filename, middleware_factory=None, middleware_factory_kwargs=None): """Parse this from a filname""" file_url = filename_to_url(filename) file = open(filename) tree = parse(file, base_url=file_url) file.close() el = tree.getroot() tree.xinclude() return cls.parse_xml(el, file_url, middleware_factory=middleware_factory, middleware_factory_kwargs=middleware_factory_kwargs)
def parse_file(cls, filename, middleware_factory=None, middleware_factory_kwargs=None): """Parse this from a filname""" file_url = filename_to_url(filename) file = open(filename) tree = parse(file, base_url=file_url) file.close() el = tree.getroot() tree.xinclude() return cls.parse_xml( el, file_url, middleware_factory=middleware_factory, middleware_factory_kwargs=middleware_factory_kwargs)
def setup(): global app el = fromstring(""" <proxy path="/_theme"> <dest href="{here}/test_content" /> </proxy> """) here = resource_filename("deliverance", "tests/test_proxy.py") proxy = Proxy.parse_xml(el, filename_to_url(here)) class FakeMiddleware(object): def link_to(*args, **kw): return "<url %s, %s>" % (args, kw) def wsgi_app(environ, start_response): middleware = FakeMiddleware() environ['deliverance.log'] = SavingLogger(Request(environ), middleware) return proxy.forward_request(environ, start_response) app = TestApp(wsgi_app)
def parse_file(cls, filename): """Parse this from a filname""" file_url = filename_to_url(filename) el = parse(filename, base_url=file_url).getroot() return cls.parse_xml(el, file_url)