classification
Title: ElementPath 1.3 expressions documentation
Type: behavior Stage: resolved
Components: XML Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eli.bendersky, flox, mikehoy, patrick.vrijlandt, python-dev
Priority: normal Keywords: easy, patch

Created on 2011-06-13 10:02 by patrick.vrijlandt, last changed 2012-10-10 02:32 by mikehoy. This issue is now closed.

Files
File name Uploaded Description Edit
issue12322_v1.diff mikehoy, 2012-10-08 06:49
issue12322_v2.diff mikehoy, 2012-10-08 20:44 Returns None
Messages (9)
msg138229 - (view) Author: patrick vrijlandt (patrick.vrijlandt) Date: 2011-06-13 10:02
Python 3.2 supports ElementPath version 1.3. The relevant documentation is
http://effbot.org/zone/element-xpath.htm. It says:
..	(New in 1.3) Selects the parent element.

However, a CHANGES document says:
The engine also provides limited support for the ".." parent operator; you can use it inside the subtree, but it cannot go above the target element (the element you called "find" on).  

The normal documentation should document the limitation.
msg171728 - (view) Author: Mike Hoy (mikehoy) * Date: 2012-10-01 16:03
Here is a link to our docs page with the info that needs to be changed:

http://docs.python.org/py3k/library/xml.etree.elementtree.html#supported-xpath-syntax

I was going to work on a patch but in irc we decided to wait to see what people had to say about this. Also we think documenting the Error you receive (if any) when trying to go above the "found" element may be a necessary part of the doc change.
msg172298 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2012-10-07 13:21
Thanks for the report, Patrick. Yes, documenting this limitation would make sense. Have you tested to see how it behaves?

Anyhow, a patch would be welcome ;-)
msg172362 - (view) Author: Mike Hoy (mikehoy) * Date: 2012-10-08 06:49
It doesn't look like there are any errors to document. I'm attaching a patch that Patrick suggested.
msg172410 - (view) Author: patrick vrijlandt (patrick.vrijlandt) Date: 2012-10-08 20:25
To be complete: an xpath 'above' the start element returns None

Thanks for the patch!
msg172413 - (view) Author: Mike Hoy (mikehoy) * Date: 2012-10-08 20:44
In response to patrick vrijlandt last comment here's a patch. I also found a few None keywords that didn't have `` around them.
msg172480 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-09 13:47
New changeset 79231a12567a by Eli Bendersky in branch '3.3':
Issue #12322: clarify xpath reference for cases where the path reaches ancestors of the start element. Also add missing markup for a None. Thanks to patrick vrijlandt and Mike Hoy for the report and initial patches.
http://hg.python.org/cpython/rev/79231a12567a

New changeset 5cb3c08997e6 by Eli Bendersky in branch 'default':
Merge 3.3
http://hg.python.org/cpython/rev/5cb3c08997e6
msg172481 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2012-10-09 13:48
Changes pushed. Thanks for the report and patches.

Mike - a note for the future: when you create an updated patch, create it anew vs. a clean repo. Don't "compound" patches.
msg172549 - (view) Author: Mike Hoy (mikehoy) * Date: 2012-10-10 02:32
>> Mike - a note for the future: when you create an updated patch, create it anew vs. a clean repo. Don't "compound" patches.

No problem, thanks for committing the patch. Wasn't aware that compounding patches caused a problem.
History
Date User Action Args
2012-10-10 02:32:35mikehoysetmessages: + msg172549
2012-10-09 13:48:43eli.benderskysetstatus: open -> closed
resolution: fixed
messages: + msg172481

stage: needs patch -> resolved
2012-10-09 13:47:30python-devsetnosy: + python-dev
messages: + msg172480
2012-10-08 20:44:31mikehoysetfiles: + issue12322_v2.diff

messages: + msg172413
2012-10-08 20:25:13patrick.vrijlandtsetmessages: + msg172410
2012-10-08 06:49:11mikehoysetfiles: + issue12322_v1.diff
keywords: + patch
messages: + msg172362
2012-10-07 13:21:35eli.benderskysetmessages: + msg172298
stage: needs patch
2012-10-01 16:03:56mikehoysetnosy: + mikehoy
messages: + msg171728
2012-07-21 14:10:19floxsetkeywords: + easy
nosy: + eli.bendersky

versions: + Python 3.3
2011-06-13 12:58:34pitrousetnosy: + flox
2011-06-13 10:02:49patrick.vrijlandtcreate