foliapy icon indicating copy to clipboard operation
foliapy copied to clipboard

[folia] Let xpath() fail more informatively

Open asharkinasuit opened this issue 7 years ago • 1 comments

Right now, the XML tree is discarded unless mode=XPATH was a keyword argument. If the xpath function is called on a document not in this mode, it fails with AttributeError: 'NoneType' object has no attribute 'xpath', which can be confusing. It's probably easy and good practice to check the mode in that method before trying to make the call that can lead to that error, and raise a more informative exception when appropriate.

asharkinasuit avatar Mar 29 '18 08:03 asharkinasuit

Right, good point!

proycon avatar Mar 29 '18 11:03 proycon