# HG changeset patch # User paulb # Date 1116113414 0 # Node ID 33df1847dcdee009058e48cf87f8e1fbc499b1f8 # Parent d341a3f321ed6d97bb65ab83536d913d0f277a92 [project @ 2005-05-14 23:30:14 by paulb] Fixed transformations for Python 2.4.1 - detection of nodes within their parents failed, thus a more direct test is used to determine if each node is in a list or not. diff -r d341a3f321ed -r 33df1847dcde libxml2macro.py --- a/libxml2macro.py Sat Apr 09 16:21:10 2005 +0000 +++ b/libxml2macro.py Sat May 14 23:30:14 2005 +0000 @@ -170,13 +170,11 @@ ) for key, value in parent.__dict__.items(): # Detect lists. - try: - if node in value: - index = value.index(node) - value[index] = replacement - except TypeError: - if value is node: - parent.__dict__[key] = replacement + if hasattr(value, "len") and node in value: + index = value.index(node) + value[index] = replacement + elif value is node: + parent.__dict__[key] = replacement # Propagate whether the kind of result might need transforming itself.