From e7f67298d2bdac37e4a98138a3647ad9dde301f3 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 10 Nov 2011 14:21:17 -0500 Subject: [PATCH] initial checkin --- sfa/rspecs/elements/versions/sfav1PLTag.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sfa/rspecs/elements/versions/sfav1PLTag.py diff --git a/sfa/rspecs/elements/versions/sfav1PLTag.py b/sfa/rspecs/elements/versions/sfav1PLTag.py new file mode 100644 index 00000000..bc3b81c7 --- /dev/null +++ b/sfa/rspecs/elements/versions/sfav1PLTag.py @@ -0,0 +1,19 @@ +from sfa.rspecs.elements.element import Element +from sfa.rspecs.elements.pl_tag import PLTag + +class SFAv1PLTag: + @staticmethod + def add_pl_tags(xml, pl_tags): + for pl_tag in pl_tags: + pl_tag_elem = xml.add_element(pl_tag['name']) + pl_tag_elem.set_text(pl_tag['value']) + + @staticmethod + def get_pl_tags(xml, ignore=[]): + pl_tags = [] + for elem in xml.iterchildren(): + if elem.tag not in ignore: + pl_tag = PLTag({'name': elem.tag, 'value': elem.text}) + pl_tags.appen(pl_tag) + return pl_tags + -- 2.43.0