Exemple #1
0
def _parse_event(ancestry: _IntermediateAncestry, element: Element):
    handle = str(_xpath1(element, './@handle'))
    event_id = _xpath1(element, './@id')
    gramps_type = _xpath1(element, './ns:type')

    try:
        event_type = _EVENT_TYPE_MAP[gramps_type.text]
    except KeyError:
        event_type = UnknownEventType()
        logging.getLogger().warning(
            'Betty is unfamiliar with Gramps event "%s"\'s type of "%s". The event was imported, but its type was set to "%s".'
            % (event_id, gramps_type.text, event_type.label))

    event = IdentifiableEvent(event_id, event_type)

    event.date = _parse_date(element)

    # Parse the event place.
    place_handle = _xpath1(element, './ns:place/@hlink')
    if place_handle:
        event.place = ancestry.places[place_handle]

    # Parse the description.
    description_element = _xpath1(element, './ns:description')
    if description_element is not None:
        event.description = description_element.text

    _parse_objref(ancestry, event, element)
    _parse_citationref(ancestry, event, element)
    _parse_attribute_privacy(event, element, 'attribute')
    ancestry.events[handle] = event
Exemple #2
0
def _load_event(loader: _Loader, element: ElementTree.Element):
    handle = element.get('handle')
    event_id = element.get('id')
    gramps_type = _xpath1(element, './ns:type')

    try:
        event_type = _EVENT_TYPE_MAP[gramps_type.text]
    except KeyError:
        event_type = UnknownEventType()
        logging.getLogger().warning(
            'Betty is unfamiliar with Gramps event "%s"\'s type of "%s". The event was imported, but its type was set to "%s".' % (event_id, gramps_type.text, event_type.label))

    event = IdentifiableEvent(event_id, event_type)

    event.date = _load_date(element)

    # Load the event place.
    place_handle_element = _xpath1(element, './ns:place')
    if place_handle_element is not None:
        event.place = loader._places[place_handle_element.get('hlink')]

    # Load the description.
    description_element = _xpath1(element, './ns:description')
    if description_element is not None:
        event.description = description_element.text

    _load_objref(loader, event, element)
    _load_citationref(loader, event, element)
    _load_attribute_privacy(event, element, 'attribute')
    loader._events[handle] = event
Exemple #3
0
def _parse_event(ancestry: _IntermediateAncestry, element: Element):
    handle = str(_xpath1(element, './@handle'))
    gramps_type = _xpath1(element, './ns:type')

    event = IdentifiableEvent(_xpath1(element, './@id'), _EVENT_TYPE_MAP[gramps_type.text])

    event.date = _parse_date(element)

    # Parse the event place.
    place_handle = _xpath1(element, './ns:place/@hlink')
    if place_handle:
        event.place = ancestry.places[place_handle]

    # Parse the description.
    description_element = _xpath1(element, './ns:description')
    if description_element is not None:
        event.description = description_element.text

    _parse_objref(ancestry, event, element)
    _parse_citationref(ancestry, event, element)
    _parse_attribute_privacy(event, element)
    ancestry.events[handle] = event