Re: [lxml] Personal problems with resolve_string
Thanks, Jens, that's the answer.
As I say, I'll probably have more questions about the resolvers in time.
Rg.
________________________________
From: Jens Quade
class simple_string_resolver(etree.Resolver):
def resolve(self, url, id, context): ... # pass this byte object to the resolve_string method return etree.Resolver.resolve_string(content, id, context, base_url=url)
according to http://lxml.de/1.3/resolvers.html#resolvers self.resolve_string( or etree.Resolver.resolve_string(self, should work. (and do the same, as long as you do not overwrite resolve_string in your simple_string_resolver class.). Also, you may want to follow PEP 8 https://www.python.org/dev/peps/pep-0008/ when naming things (like SimpleStringResolver). best, jens ________________________________ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. ________________________________
participants (1)
-
Duthie, Roger J.A.