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.
________________________________ From: Jens Quade firstname.lastname@example.org Sent: 22 May 2018 23:59:56 To: Duthie, Roger J.A. Subject: Re: [lxml] Personal problems with resolve_string
I haven’t worked with the Resolver class, but if you call the method via the class (and not by self.), shouldn’t the first parameter be self?
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
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).
________________________________ 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. ________________________________
Duthie, Roger J.A.