예제 #1
0
    def from_xml(cls, xml_tree):

        room = Room()
        room.name = xml_tree.get('name')
        room.numberofdoors = xml_tree.get('numberofdoors')

        for potential_annot in xml_tree.getchildren():
            if potential_annot.tag.lower() == Annotation.get_tag().lower():
                room.annotation = Annotation.from_xml(potential_annot)

        return room
예제 #2
0
    def from_xml_local(cls, xml_tree):
        loc = Location()
        loc.name = xml_tree.get('name')
        loc.isbeacon = xml_tree.get('isbeacon') == 'true'
        loc.isplacement = xml_tree.get('isplacement') == 'true'

        for potential_annot in xml_tree.getchildren():
            if potential_annot.tag.lower() == Annotation.get_tag().lower():
                loc.annotation = Annotation.from_xml(potential_annot)

        loc.room = xml_tree.get('room')

        return loc
예제 #3
0
    def from_xml(cls, xml_tree):
        loc = Location()
        loc.name = xml_tree.get('name')
        loc.isbeacon = xml_tree.get('isbeacon') == 'true'
        loc.isplacement = xml_tree.get('isplacement') == 'true'

        for potential_annot in xml_tree.getchildren():
            if potential_annot.tag.lower() == Annotation.get_tag().lower():
                loc.annotation = Annotation.from_xml(potential_annot)

        room = xml_tree.get('room')
        room_doc = Room.objects(name=room).get()
        if not type(room_doc) == Room:
            raise NoSuchRoomException()
        loc.room = room_doc

        return loc