[lxml-dev] Failure with custom resolvers and relative xsl:import

Stefan Behnel stefan_ml at behnel.de
Mon Aug 18 22:16:53 CEST 2008


Hi,

Sidnei da Silva wrote:
> On Mon, Aug 18, 2008 at 4:04 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>> The problem here is that lxml currently only takes the .name attribute of a
>> file object to determine the file name. The right thing to do would be to use
>> os.path.abspath(f.name) instead to retrieve the absolute path name of the file.
>>
>> Using resolve_filename(filename) instead of resolve_file(open(filename))
>> provides a more efficient work around, though.
> 
> Okay, I think that solves one of the problems, when the filename is
> local. I suspect it won't solve the other problem I had, which was
> when the file comes from urlopen(). Since the files are relatively
> small though I can keep using resolve_string() for now.

I'm working on fixing this. However, do you really need something from urlopen
that lxml can't handle by itself? Any "HTTP GET" or "FTP get" request should
work when passed as an encoded URL. HTTP POSTs and request options won't work,
but they are pretty rarely used when requesting pages. HTTPS also won't work,
which I would consider more important.

Stefan


More information about the lxml-dev mailing list