* src/Date.py: set default modifier properly, fix compare and sortval
assignment * src/RelLib.py: fix source reference date comparison svn: r5299
This commit is contained in:
parent
91ed326d7a
commit
69bc0f70b7
@ -1,3 +1,8 @@
|
||||
2005-10-10 Don Allingham <don@gramps-project.org>
|
||||
* src/Date.py: set default modifier properly, fix compare and sortval
|
||||
assignment
|
||||
* src/RelLib.py: fix source reference date comparison
|
||||
|
||||
2005-10-09 Julio Sanchez <jsanchez@users.sourceforge.net>
|
||||
* src/WriteGedcom.py: fixed error caused by incomplete migration to
|
||||
handle-based storage API
|
||||
|
@ -122,7 +122,7 @@ class Date:
|
||||
self.sortval = source.sortval
|
||||
else:
|
||||
self.calendar = CAL_GREGORIAN
|
||||
self.modifier = MOD_TEXTONLY
|
||||
self.modifier = MOD_NONE
|
||||
self.quality = QUAL_NONE
|
||||
self.dateval = EMPTY
|
||||
self.text = u""
|
||||
@ -157,12 +157,13 @@ class Date:
|
||||
at the sorting value, and ignores the modifiers/comments.
|
||||
"""
|
||||
if self.modifier == other.modifier and self.modifier == MOD_TEXTONLY:
|
||||
return self.text == other.text
|
||||
return (self.calendar == other.calendar and
|
||||
self.modifier == other.modifier and
|
||||
self.quality == other.quality and
|
||||
self.dateval == other.dateval and
|
||||
self.sortval == other.sortval)
|
||||
value = self.text == other.text
|
||||
else:
|
||||
value = (self.calendar == other.calendar and
|
||||
self.modifier == other.modifier and
|
||||
self.quality == other.quality and
|
||||
self.dateval == other.dateval)
|
||||
return value
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
@ -455,7 +456,10 @@ class Date:
|
||||
year = max(value[_POS_YR],1)
|
||||
month = max(value[_POS_MON],1)
|
||||
day = max(value[_POS_DAY],1)
|
||||
self.sortval = _calendar_convert[calendar](year,month,day)
|
||||
if year == 0 and month == 0 and day == 0:
|
||||
self.sortval = 0
|
||||
else:
|
||||
self.sortval = _calendar_convert[calendar](year,month,day)
|
||||
if text:
|
||||
self.text = text
|
||||
|
||||
@ -463,7 +467,10 @@ class Date:
|
||||
year = max(self.dateval[_POS_YR],1)
|
||||
month = max(self.dateval[_POS_MON],1)
|
||||
day = max(self.dateval[_POS_DAY],1)
|
||||
self.sortval = _calendar_convert[self.calendar](year,month,day)
|
||||
if year == 0 and month == 0 and day == 0:
|
||||
self.sortval = 0
|
||||
else:
|
||||
self.sortval = _calendar_convert[self.calendar](year,month,day)
|
||||
|
||||
def convert_calendar(self,calendar):
|
||||
"""
|
||||
|
@ -2242,6 +2242,7 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
|
||||
"""
|
||||
if other == None:
|
||||
other = Event (None)
|
||||
|
||||
if (self.name != other.name or
|
||||
((self.place or other.place) and (self.place != other.place)) or
|
||||
self.description != other.description or self.cause != other.cause or
|
||||
@ -2262,6 +2263,7 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
|
||||
if (witness_list and not other_list) or \
|
||||
(other_list and not witness_list):
|
||||
return False
|
||||
|
||||
if witness_list and other_list:
|
||||
another_list = other_list[:]
|
||||
for a in witness_list:
|
||||
@ -3983,12 +3985,7 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase):
|
||||
if self.ref and other.ref:
|
||||
if self.page != other.page:
|
||||
return False
|
||||
if (self.date and other.date and \
|
||||
not self.date.is_equal(other.date)) \
|
||||
or ((not self.date) and other.date and \
|
||||
not other.date.is_empty()) \
|
||||
or ((not other.date) and self.date and \
|
||||
not self.date.is_empty()):
|
||||
if not self.get_date_object().is_equal(other.get_date_object()):
|
||||
return False
|
||||
if self.get_text() != other.get_text():
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user