Do not set patronimic, just give a warning. (Not sure how it is used by

Pro-Gen.)
Accept other input filenames (.PER, .REL or .MEM) as well.
        * src/plugins/ImportProGen.py


svn: r10767
This commit is contained in:
Kees Bakker 2008-05-29 18:55:13 +00:00
parent d1b284c50d
commit a792472852

View File

@ -177,8 +177,14 @@ def _get_defname(fname):
dir_, f = os.path.split(os.path.abspath(fname)) dir_, f = os.path.split(os.path.abspath(fname))
while dir_: while dir_:
newdefname = os.path.join(dir_, defname) newdefname = os.path.join(dir_, defname)
if os.path.exists(newdefname): if os.path.exists(newdefname):
return newdefname, defname return newdefname, defname
newdefname = newdefname.upper()
if os.path.exists(newdefname):
return newdefname, defname
# One level up
dir_, f = os.path.split(dir_) dir_, f = os.path.split(dir_)
return None, defname return None, defname
@ -424,8 +430,8 @@ class PG30_Def:
class ProgenParser: class ProgenParser:
def __init__(self, dbase, file_): def __init__(self, dbase, file_):
self.bname, ext = os.path.splitext(file_) self.bname, ext = os.path.splitext(file_)
if ext.lower() != '.def': if ext.lower() in ('.per', '.rel', '.mem'):
raise ProgenError(_("Expecting a file with .def extension")) file_ = self.bname + '.def'
self.db = dbase self.db = dbase
self.fname = file_ self.fname = file_
@ -560,7 +566,7 @@ class ProgenParser:
__date_pat1 = re.compile(r'(?P<day>\d{1,2}) (-|=) (?P<month>\d{1,2}) (-|=) (?P<year>\d{2,4})', re.VERBOSE) __date_pat1 = re.compile(r'(?P<day>\d{1,2}) (-|=) (?P<month>\d{1,2}) (-|=) (?P<year>\d{2,4})', re.VERBOSE)
__date_pat2 = re.compile(r'(?P<month>\d{1,2}) (-|=) (?P<year>\d{4})', re.VERBOSE) __date_pat2 = re.compile(r'(?P<month>\d{1,2}) (-|=) (?P<year>\d{4})', re.VERBOSE)
__date_pat3 = re.compile(r'(?P<year>\d{4})', re.VERBOSE) __date_pat3 = re.compile(r'(?P<year>\d{4})', re.VERBOSE)
__date_pat4 = re.compile(ur'(v|vóór|voor|na|circa|ca|rond) \s* (?P<year>\d{4})', re.VERBOSE) __date_pat4 = re.compile(ur'(v|vóór|voor|na|circa|ca|rond) \s* (?P<year>\d{4})', re.VERBOSE)
__date_pat5 = re.compile(r'(oo|OO) (-|=) (oo|OO) (-|=) (?P<year>\d{2,4})', re.VERBOSE) __date_pat5 = re.compile(r'(oo|OO) (-|=) (oo|OO) (-|=) (?P<year>\d{2,4})', re.VERBOSE)
def __create_date_from_text(self, txt, diag_msg=None): def __create_date_from_text(self, txt, diag_msg=None):
''' '''
@ -738,7 +744,8 @@ class ProgenParser:
if recflds[call_name_ix]: if recflds[call_name_ix]:
name.set_call_name(recflds[call_name_ix]) name.set_call_name(recflds[call_name_ix])
if patronym: if patronym:
name.set_patronymic(patronym) log.warning("Patroniem, %s: '%s'" % (diag_msg, patronym))
#name.set_patronymic(patronym)
person.set_primary_name(name) person.set_primary_name(name)
person.set_gender(gender) person.set_gender(gender)
@ -837,6 +844,14 @@ class ProgenParser:
note.set_type(gen.lib.NoteType.EVENT) note.set_type(gen.lib.NoteType.EVENT)
self.db.add_note(note, self.trans) self.db.add_note(note, self.trans)
event.add_note(note.handle) event.add_note(note.handle)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Baptism, %s: '%s'" % (diag_msg, note_text))
note = gen.lib.Note()
note.set(note_txt)
note.set_type(gen.lib.NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
# Death # Death
date = self.__create_date_from_text(recflds[death_date_ix], diag_msg) date = self.__create_date_from_text(recflds[death_date_ix], diag_msg)