* src/DateParser.py: try to detect illegal numerical dates
* src/Utils.py: not_too_old moved over from RelLib.py * src/WriteGedcom.py: fix call to probably_alive svn: r3618
This commit is contained in:
parent
e6783320cb
commit
6078827986
@ -1,4 +1,5 @@
|
|||||||
2004-10-10 Don Allingham <dallingham@users.sourceforge.net>
|
2004-10-10 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/DateParser.py: try to detect illegal numerical dates
|
||||||
* src/GrampsInMemDB.py: handle null handle
|
* src/GrampsInMemDB.py: handle null handle
|
||||||
* src/GrampsXMLDB.py: disable undo during normal read of database
|
* src/GrampsXMLDB.py: disable undo during normal read of database
|
||||||
* src/ReadGedcom.py: handle lines shorter than 50 lines, disable undo during
|
* src/ReadGedcom.py: handle lines shorter than 50 lines, disable undo during
|
||||||
@ -6,6 +7,8 @@
|
|||||||
* src/ReadXML.py: disable undo during normal read of databas
|
* src/ReadXML.py: disable undo during normal read of databas
|
||||||
* src/RelLib.py: revert Name.__cmp__ to Name.is_equal
|
* src/RelLib.py: revert Name.__cmp__ to Name.is_equal
|
||||||
* src/docgen/HTMLDoc.py: drop deprecated gnome.ui dialogs
|
* src/docgen/HTMLDoc.py: drop deprecated gnome.ui dialogs
|
||||||
|
* src/Utils.py: not_too_old moved over from RelLib.py
|
||||||
|
* src/WriteGedcom.py: fix call to probably_alive
|
||||||
|
|
||||||
2004-10-10 Eero Tamminen <eerot@sf>
|
2004-10-10 Eero Tamminen <eerot@sf>
|
||||||
* TestPlan.txt: Add test for reports like in stable version
|
* TestPlan.txt: Add test for reports like in stable version
|
||||||
|
@ -337,7 +337,10 @@ class DateParser:
|
|||||||
y = self._get_int(groups[0])
|
y = self._get_int(groups[0])
|
||||||
m = self._get_int(groups[1])
|
m = self._get_int(groups[1])
|
||||||
d = self._get_int(groups[2])
|
d = self._get_int(groups[2])
|
||||||
return (d,m,y,False)
|
if gregorian_valid((d,m)):
|
||||||
|
return (d,m,y,False)
|
||||||
|
else:
|
||||||
|
return Date.EMPTY
|
||||||
|
|
||||||
match = self._rfc.match(text)
|
match = self._rfc.match(text)
|
||||||
if match:
|
if match:
|
||||||
@ -345,7 +348,10 @@ class DateParser:
|
|||||||
d = self._get_int(groups[2])
|
d = self._get_int(groups[2])
|
||||||
m = self._rfc_mons_to_int[groups[3]]
|
m = self._rfc_mons_to_int[groups[3]]
|
||||||
y = self._get_int(groups[4])
|
y = self._get_int(groups[4])
|
||||||
return (d,m,y,False)
|
if gregorian_valid((d,m)):
|
||||||
|
return (d,m,y,False)
|
||||||
|
else:
|
||||||
|
return Date.EMPTY
|
||||||
|
|
||||||
match = self._numeric.match(text)
|
match = self._numeric.match(text)
|
||||||
if match:
|
if match:
|
||||||
@ -353,7 +359,10 @@ class DateParser:
|
|||||||
m = self._get_int(groups[1])
|
m = self._get_int(groups[1])
|
||||||
d = self._get_int(groups[3])
|
d = self._get_int(groups[3])
|
||||||
y = self._get_int(groups[4])
|
y = self._get_int(groups[4])
|
||||||
return (d,m,y,False)
|
if gregorian_valid((d,m)):
|
||||||
|
return (d,m,y,False)
|
||||||
|
else:
|
||||||
|
return Date.EMPTY
|
||||||
|
|
||||||
return Date.EMPTY
|
return Date.EMPTY
|
||||||
|
|
||||||
@ -451,3 +460,15 @@ class DateParser:
|
|||||||
new_date = Date.Date()
|
new_date = Date.Date()
|
||||||
self.set_date(new_date,text)
|
self.set_date(new_date,text)
|
||||||
return new_date
|
return new_date
|
||||||
|
|
||||||
|
_max_days = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
|
||||||
|
|
||||||
|
def gregorian_valid(date_tuple):
|
||||||
|
day = date_tuple[0]
|
||||||
|
month = date_tuple[1]
|
||||||
|
valid = True
|
||||||
|
if month > 12:
|
||||||
|
valid = False
|
||||||
|
elif day > _max_days[month]:
|
||||||
|
valid = False
|
||||||
|
return valid
|
||||||
|
@ -2243,8 +2243,3 @@ class GenderStats:
|
|||||||
|
|
||||||
return Person.unknown
|
return Person.unknown
|
||||||
|
|
||||||
def not_too_old(date):
|
|
||||||
time_struct = time.localtime(time.time())
|
|
||||||
current_year = time_struct[0]
|
|
||||||
year = date.get_year()
|
|
||||||
return not( year != 0 and current_year - year > 110)
|
|
||||||
|
@ -45,6 +45,7 @@ import gnome
|
|||||||
import const
|
import const
|
||||||
import RelImage
|
import RelImage
|
||||||
import GrampsMime
|
import GrampsMime
|
||||||
|
import Date
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -664,6 +665,12 @@ def probably_alive(person,db):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def not_too_old(date):
|
||||||
|
time_struct = time.localtime(time.time())
|
||||||
|
current_year = time_struct[0]
|
||||||
|
year = date.get_year()
|
||||||
|
return not( year != 0 and current_year - year > 110)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -51,6 +51,8 @@ import Date
|
|||||||
import GedcomInfo
|
import GedcomInfo
|
||||||
import Errors
|
import Errors
|
||||||
import ansel_utf8
|
import ansel_utf8
|
||||||
|
import Utils
|
||||||
|
import Date
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
|
|
||||||
@ -750,7 +752,7 @@ class GedcomWriter:
|
|||||||
|
|
||||||
def write_person(self,person):
|
def write_person(self,person):
|
||||||
self.writeln("0 @%s@ INDI" % person.get_gramps_id())
|
self.writeln("0 @%s@ INDI" % person.get_gramps_id())
|
||||||
restricted = self.restrict and probably_alive (person,self.db)
|
restricted = self.restrict and Utils.probably_alive (person,self.db)
|
||||||
self.prefn(person)
|
self.prefn(person)
|
||||||
primaryname = person.get_primary_name ()
|
primaryname = person.get_primary_name ()
|
||||||
if restricted and self.living:
|
if restricted and self.living:
|
||||||
|
Loading…
Reference in New Issue
Block a user