Handle XXXX/XXXX
svn: r176
This commit is contained in:
parent
c402481385
commit
d9ad71dbaf
@ -35,7 +35,7 @@ class Date:
|
|||||||
formatCode = 0
|
formatCode = 0
|
||||||
entryCode = 0
|
entryCode = 0
|
||||||
|
|
||||||
Error = _("Illegal Date")
|
Error = "Illegal Date"
|
||||||
|
|
||||||
range = 1
|
range = 1
|
||||||
normal = 0
|
normal = 0
|
||||||
@ -357,7 +357,6 @@ class SingleDate:
|
|||||||
def setMonth(self,val):
|
def setMonth(self,val):
|
||||||
if val > 12:
|
if val > 12:
|
||||||
self.month = -1
|
self.month = -1
|
||||||
print "Bad month index : %d" % val
|
|
||||||
else:
|
else:
|
||||||
self.month = val - 1
|
self.month = val - 1
|
||||||
|
|
||||||
@ -777,11 +776,13 @@ class SingleDate:
|
|||||||
self.getMode(matches[0])
|
self.getMode(matches[0])
|
||||||
try:
|
try:
|
||||||
self.month = int(matches[1])-1
|
self.month = int(matches[1])-1
|
||||||
except:
|
if self.month > 11:
|
||||||
|
raise Date.Error,text
|
||||||
|
except ValueError:
|
||||||
self.month = -1
|
self.month = -1
|
||||||
try:
|
try:
|
||||||
self.year = int(matches[2])
|
self.year = int(matches[2])
|
||||||
except:
|
except ValueError:
|
||||||
self.year = -1
|
self.year = -1
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@ -792,20 +793,24 @@ class SingleDate:
|
|||||||
if Date.entryCode == 0:
|
if Date.entryCode == 0:
|
||||||
try:
|
try:
|
||||||
self.month = int(matches[1])-1
|
self.month = int(matches[1])-1
|
||||||
except:
|
if self.month > 11:
|
||||||
|
raise Date.Error,text
|
||||||
|
except ValueError:
|
||||||
self.month = -1
|
self.month = -1
|
||||||
try:
|
try:
|
||||||
self.day = int(matches[2])
|
self.day = int(matches[2])
|
||||||
except:
|
except ValueError:
|
||||||
self.day = -1
|
self.day = -1
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.month = int(matches[2])-1
|
self.month = int(matches[2])-1
|
||||||
except:
|
if self.month > 11:
|
||||||
|
raise Date.Error,text
|
||||||
|
except ValueError:
|
||||||
self.month = -1
|
self.month = -1
|
||||||
try:
|
try:
|
||||||
self.day = int(matches[1])
|
self.day = int(matches[1])
|
||||||
except:
|
except ValueError:
|
||||||
self.day = -1
|
self.day = -1
|
||||||
val = matches[3]
|
val = matches[3]
|
||||||
if val == None or val[0] == '?':
|
if val == None or val[0] == '?':
|
||||||
@ -850,6 +855,8 @@ class SingleDate:
|
|||||||
matches = match.groups()
|
matches = match.groups()
|
||||||
self.getMode(matches[0])
|
self.getMode(matches[0])
|
||||||
self.month = int(matches[1])-1
|
self.month = int(matches[1])-1
|
||||||
|
if self.month > 11:
|
||||||
|
raise Date.Error,text
|
||||||
self.day = -1
|
self.day = -1
|
||||||
self.year = -1
|
self.year = -1
|
||||||
return 1
|
return 1
|
||||||
|
@ -442,7 +442,7 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
#
|
#
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
def stop_uid(self,tag):
|
def stop_uid(self,tag):
|
||||||
self.person.setPafUid(tag)
|
self.person.setPafUid(u2l(tag))
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -452,9 +452,9 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
def stop_date(self,tag):
|
def stop_date(self,tag):
|
||||||
if tag:
|
if tag:
|
||||||
if self.address:
|
if self.address:
|
||||||
self.address.setDate(tag)
|
self.address.setDate(u2l(tag))
|
||||||
else:
|
else:
|
||||||
self.event.date.quick_set(tag)
|
self.event.date.quick_set(u2l(tag))
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user