def import_one(session, input, element=None, name=None): if element == None: element = Node() tree = ElementTree.fromstring(input) if tree.tag == "node": element = Role.import_one(tree, element, name) room = tree.findtext("room") if room != None: element = Node.edit_one(session, element, "room", room) if not isinstance(element, Node): return element title = tree.findtext("title") if title != None: Node.edit_one(session, element, "title", title) type = tree.findtext("type") if type != None: Node.edit_one(session, element, "type", type) input = tree.findtext("input") if input != None: Node.edit_one(session, element, "input", input) output = tree.findtext("output") if output != None: Node.edit_one(session, element, "output", output) return element else: return Node.ERROR_TAG_NOT_VALID
def import_one(session, input, element=None, name=None): if element == None: element = Monitor() tree = ElementTree.fromstring(input) if tree.tag == "monitor": element = Role.import_one(tree, element, name) return element else: return Monitor.ERROR_TAG_NOT_VALID
def import_one(session, input, element=None, name=None): if element == None: element = Backend() tree = ElementTree.fromstring(input) if tree.tag == "backend": element = Role.import_one(tree, element, name) master = tree.findtext("master") if master != None: Backend.edit_one(session, element, "master", master) return element else: return Backend.ERROR_TAG_NOT_VALID
def import_one(session, input, element=None, name=None): if element == None: element = User() tree = ElementTree.fromstring(input) if tree.tag == "user": element = Role.import_one(tree, element, name) room = tree.findtext("room") if room != None: element = User.edit_one(session, element, "room", room) if not isinstance(element, User): return element receive_room = tree.findtext("receive_room") if receive_room != None: element = User.edit_one(session, element, "receive_room", receive_room) if not isinstance(element, User): return element admin = tree.findtext("admin") if admin != None: User.edit_one(session, element, "admin", admin) return element else: return User.ERROR_TAG_NOT_VALID