* src/ReadGedcom.py: create GedcomDateParser class to handle

English requirements for GEDCOM


svn: r3838
This commit is contained in:
Don Allingham
2004-12-26 18:23:50 +00:00
parent 7b80dfb4d2
commit 5f062fccc9
8 changed files with 33 additions and 7 deletions

View File

@ -219,6 +219,14 @@ class DateStruct:
self.date = ""
self.time = ""
class GedcomDateParser(DateParser.DateParser):
month_to_int = {
'jan' : 1, 'feb' : 2, 'mar' : 3, 'apr' : 4,
'may' : 5, 'jun' : 6, 'jul' : 7, 'aug' : 8,
'sep' : 9, 'oct' : 10, 'nov' : 11, 'dec' : 12,
}
#-------------------------------------------------------------------------
#
#
@ -230,7 +238,7 @@ class GedcomParser:
BadFile = "Not a GEDCOM file"
def __init__(self, dbase, filename, window, codeset):
self.dp = DateParser.DateParser()
self.dp = GedcomDateParser()
self.db = dbase
self.person = None
self.media_map = {}
@ -1924,6 +1932,17 @@ class GedcomParser:
self.db.pmap_index = new_pmax
def invert_year(self,subdate):
return (subdate[0],subdate[1],-subdate[2],subdate[3])
def parse(self,text):
"""
Parses the text, returning a Date object.
"""
new_date = Date.Date()
self.set_date(new_date,text)
return new_date
def extract_temple(matches):
try:
if const.lds_temple_to_abrev.has_key(matches[2]):