From: Tony Mack Date: Thu, 30 Jun 2011 04:56:21 +0000 (-0400) Subject: added recursive argument to get_attributes() X-Git-Tag: sfa-1.0-27~50 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c283596b898a61e7a11db70c5f7d1675d0ad7bd7;p=sfa.git added recursive argument to get_attributes() --- diff --git a/sfa/rspecs/elements/element.py b/sfa/rspecs/elements/element.py index 495ff3e6..898706eb 100644 --- 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):