[MapProxy] GetFeatureInfo fails for infoformat html with AttributeError: 'lxml.etree._XSLTResultTree' object has no attribute 'body'

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[MapProxy] GetFeatureInfo fails for infoformat html with AttributeError: 'lxml.etree._XSLTResultTree' object has no attribute 'body'

Andreas Zapke
Hi all,

I have 2 wms sources for getfeatureinfo requests. Both uses xlst-transformation to output html. This works well for each of them if the other one is disabled, but fails for both with:

File "/usr/lib/python3.7/site-packages/mapproxy/featureinfo.py", line 125, in combine
body = tree.body.getchildren()
AttributeError: 'lxml.etree._XSLTResultTree' object has no attribute 'body'

I use: python 3.7, lxml 4.3.4 und MapProxy 1.12.0

It seems that the lxml ElementTree has no body Element here and a additional getroot() is required.
With the following changes in mapproxy/featureinfo.py the concatanation works, but maybe its not the best way?

125c125
<                 body = tree.body.getchildren()
---
>                 body = tree.getroot().body.getchildren()
127,128c127,128
<                 body = tree.getchildren()
<             result_tree.body.extend(body)
---
>                 body = tree.getroot().getchildren()
>             result_tree.getroot().body.extend(body)


Best regards
Andreas
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy
Reply | Threaded
Open this post in threaded view
|

Re: [MapProxy] GetFeatureInfo fails for infoformat html with AttributeError: 'lxml.etree._XSLTResultTree' object has no attribute 'body'

Ariel Nunez-2
Hello Andreas,

I also have no idea if that is the right approach :) but I think the next step with your patch is to both run the test suite and add a few new cases with single examples and the combined one if at all possible in the form of a pull request.

I recently got started with the test suite, so if you need help setting that up just shoot me an email.

Best,
Ariel

On Tue, 14 Apr 2020 at 2:28 AM Andreas Zapke <[hidden email]> wrote:
Hi all,

I have 2 wms sources for getfeatureinfo requests. Both uses xlst-transformation to output html. This works well for each of them if the other one is disabled, but fails for both with:

File "/usr/lib/python3.7/site-packages/mapproxy/featureinfo.py", line 125, in combine
body = tree.body.getchildren()
AttributeError: 'lxml.etree._XSLTResultTree' object has no attribute 'body'

I use: python 3.7, lxml 4.3.4 und MapProxy 1.12.0

It seems that the lxml ElementTree has no body Element here and a additional getroot() is required.
With the following changes in mapproxy/featureinfo.py the concatanation works, but maybe its not the best way?

125c125
<                 body = tree.body.getchildren()
---
>                 body = tree.getroot().body.getchildren()
127,128c127,128
<                 body = tree.getchildren()
<             result_tree.body.extend(body)
---
>                 body = tree.getroot().getchildren()
>             result_tree.getroot().body.extend(body)


Best regards
Andreas
_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy

_______________________________________________
MapProxy mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapproxy