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:
6fed739
)
replace 'recursive' argument with 'depth' argument in get_attributes()
author
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Thu, 30 Jun 2011 19:26:54 +0000
(15:26 -0400)
committer
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Thu, 30 Jun 2011 19:26:54 +0000
(15:26 -0400)
sfa/rspecs/elements/element.py
patch
|
blob
|
history
diff --git
a/sfa/rspecs/elements/element.py
b/sfa/rspecs/elements/element.py
index
898706e
..
8217c11
100644
(file)
--- a/
sfa/rspecs/elements/element.py
+++ b/
sfa/rspecs/elements/element.py
@@
-59,12
+59,12
@@
class Element:
if opt.text == value:
elem.remove(opt)
if opt.text == value:
elem.remove(opt)
- def get_attributes(self, elem=None,
recursive=Fals
e):
+ def get_attributes(self, elem=None,
depth=Non
e):
if elem == None:
elem = self.root_node
attrs = dict(elem.attrib)
attrs['text'] = str(elem.text).strip()
if elem == None:
elem = self.root_node
attrs = dict(elem.attrib)
attrs['text'] = str(elem.text).strip()
- if
recursive:
+ if
depth is None or isinstance(depth, int) and depth > 0:
for child_elem in list(elem):
key = str(child_elem.tag)
if key not in attrs:
for child_elem in list(elem):
key = str(child_elem.tag)
if key not in attrs: