git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@472 830e0280-6d2a-0410-9c65-932aecc39d9d
Michal Ludvig authored on 2011/04/08 22:45:08... | ... |
@@ -82,14 +82,16 @@ def getDictFromTree(tree): |
82 | 82 |
ret_dict = {} |
83 | 83 |
for child in tree.getchildren(): |
84 | 84 |
if child.getchildren(): |
85 |
- ## Complex-type child. We're not interested |
|
86 |
- continue |
|
85 |
+ ## Complex-type child. Recurse |
|
86 |
+ content = getDictFromTree(child) |
|
87 |
+ else: |
|
88 |
+ content = child.text |
|
87 | 89 |
if ret_dict.has_key(child.tag): |
88 | 90 |
if not type(ret_dict[child.tag]) == list: |
89 | 91 |
ret_dict[child.tag] = [ret_dict[child.tag]] |
90 |
- ret_dict[child.tag].append(child.text or "") |
|
92 |
+ ret_dict[child.tag].append(content or "") |
|
91 | 93 |
else: |
92 |
- ret_dict[child.tag] = child.text or "" |
|
94 |
+ ret_dict[child.tag] = content or "" |
|
93 | 95 |
return ret_dict |
94 | 96 |
__all__.append("getDictFromTree") |
95 | 97 |
|