Revision 1840
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/xpath.py | ||
---|---|---|
293 | 293 |
# Use last target object's ID + 1 |
294 | 294 |
obj_xpath[-1].keys = [] # just get by tag name |
295 | 295 |
last = get(root, obj_xpath, False, True) |
296 |
if last != []: id_ = str(int(xml_dom.get_id(last[0])) + 1) |
|
296 |
if last != []: id_ = str(int(util.coalesce( |
|
297 |
xml_dom.get_id(last[0]), 0)) + 1) |
|
297 | 298 |
else: id_ = '0' |
298 | 299 |
|
299 | 300 |
# Will append if target keys didn't match. |
Also available in: Unified diff
xpath.py: get(): forward (parent-to-child) pointers: If last target object exists but doesn't have an ID attr (which indicates a bug), recover gracefully by just assuming the ID is 0. (Any bug will be noticeable in the output, which needs to be generated through workarounds like this in order to be able to debug.)