From: Tony Mack Date: Thu, 30 Jun 2011 19:26:54 +0000 (-0400) Subject: replace 'recursive' argument with 'depth' argument in get_attributes() X-Git-Tag: sfa-1.0-27~45 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=e0af3e036c692734c786546620e203ab7ab783ff;p=sfa.git replace 'recursive' argument with 'depth' argument in get_attributes() --- diff --git a/sfa/rspecs/elements/element.py b/sfa/rspecs/elements/element.py index 898706eb..8217c118 100644 --- 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) - def get_attributes(self, elem=None, recursive=False): + def get_attributes(self, elem=None, depth=None): 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: