Project

General

Profile

« Previous | Next » 

Revision 2002

xpath.py: set_id(): When creating the id_path, deepcopy() the id_elem because its keys will change in the main copy

View differences:

lib/xpath.py
94 94
    id_attr = XpathElem('id', None, is_attr=True)
95 95
    
96 96
    # Save the path to the ID attr
97
    id_path = copy.copy(path[:id_level+1]) # the path up through the ID level
98
    id_path.append(copy.copy(id_attr))
97
    id_path = path[:id_level] # the path before the ID level
98
    id_path.append(copy.deepcopy(id_elem)) # this path's id_elem is independent
99
    id_path.append(copy.copy(id_attr)) # this path's id_attr is independent
99 100
    
100 101
    # Set the ID attr on the provided XPath
101 102
    id_attr.value = id_

Also available in: Unified diff