git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
153339b
)
added recursive argument to get_attributes()
author
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Thu, 30 Jun 2011 04:56:21 +0000
(
00:56
-0400)
committer
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Thu, 30 Jun 2011 04:56:21 +0000
(
00:56
-0400)
sfa/rspecs/elements/element.py
patch
|
blob
|
history
diff --git
a/sfa/rspecs/elements/element.py
b/sfa/rspecs/elements/element.py
index
495ff3e
..
898706e
100644
(file)
--- a/
sfa/rspecs/elements/element.py
+++ b/
sfa/rspecs/elements/element.py
@@
-66,8
+66,11
@@
class Element:
attrs['text'] = str(elem.text).strip()
if recursive:
for child_elem in list(elem):
- attrs[str(child_elem.tag)] = self.get_attributes(child_elem, recursive)
-
+ key = str(child_elem.tag)
+ if key not in attrs:
+ attrs[key] = [self.get_attributes(child_elem, recursive)]
+ else:
+ attrs[key].append(self.get_attributes(child_elem, recursive))
return attrs
def attributes_list(self, elem):