Fix problem with cancelling a citation edit where it thought the citation had been changed even though it had not.
svn: r18489
This commit is contained in:
parent
4de5a54136
commit
14954cdd91
@ -75,13 +75,13 @@ class Citation(MediaBase, NoteBase, PrimaryObject, DateBase):
|
||||
self.confidence = Citation.CONF_NORMAL # 4
|
||||
self.datamap = {} # 8
|
||||
|
||||
def serialize(self):
|
||||
def serialize(self, no_text_date = False):
|
||||
"""
|
||||
Convert the object to a serialized tuple of data.
|
||||
"""
|
||||
return (self.handle, # 0
|
||||
self.gramps_id, # 1
|
||||
DateBase.serialize(self), # 2
|
||||
DateBase.serialize(self, no_text_date),# 2
|
||||
unicode(self.page), # 3
|
||||
self.confidence, # 4
|
||||
self.source_handle, # 5
|
||||
|
@ -432,6 +432,29 @@ class EditCitation(EditPrimary):
|
||||
self.callback(self.obj.get_handle())
|
||||
self.close()
|
||||
|
||||
def data_has_changed(self):
|
||||
"""
|
||||
A date comparison can fail incorrectly because we have made the
|
||||
decision to store entered text in the date. However, there is no
|
||||
entered date when importing from a XML file, so we can get an
|
||||
incorrect fail.
|
||||
"""
|
||||
|
||||
if self.db.readonly:
|
||||
return False
|
||||
elif self.obj.handle:
|
||||
orig = self.get_from_handle(self.obj.handle)
|
||||
if orig:
|
||||
cmp_obj = orig
|
||||
else:
|
||||
cmp_obj = self.empty_object()
|
||||
return cmp(cmp_obj.serialize(True)[1:],
|
||||
self.obj.serialize(True)[1:]) != 0
|
||||
else:
|
||||
cmp_obj = self.empty_object()
|
||||
return cmp(cmp_obj.serialize(True)[1:],
|
||||
self.obj.serialize()[1:]) != 0
|
||||
|
||||
class DeleteCitationQuery(object):
|
||||
def __init__(self, dbstate, uistate, citation, the_lists):
|
||||
self.citation = citation
|
||||
|
Loading…
Reference in New Issue
Block a user