2006-09-09 Don Allingham <don@gramps-project.org>

* src/GrampsDb/_ReadXML.py: remove commented out code
	* src/Editors/_EditEvent.py: handle overwriting of date text
	* src/RelLib/_DateBase.py: allow optional dropping of date text on
	serialization
	* src/RelLib/_Date.py: allow optional dropping of date text on
	serialization
	* src/RelLib/_Event.py: allow optional dropping of date text on
	serialization



svn: r7306
This commit is contained in:
Don Allingham
2006-09-09 17:10:13 +00:00
parent 52b44be3aa
commit 76cce7e656
8 changed files with 64 additions and 73 deletions

View File

@@ -135,12 +135,17 @@ class Date:
self.text = u""
self.sortval = 0
def serialize(self):
def serialize(self, no_text_date=False):
"""
Convert to a series of tuples for data storage
"""
if no_text_date:
text = u''
else:
text = self.text
return (self.calendar, self.modifier, self.quality,
self.dateval, self.text, self.sortval)
self.dateval, text, self.sortval)
def unserialize(self, data):
"""

View File

@@ -53,11 +53,11 @@ class DateBase:
else:
self.date = Date()
def serialize(self):
def serialize(self, no_text_date=False):
if self.date == None or (self.date.is_empty() and not self.date.text):
date = None
else:
date = self.date.serialize()
date = self.date.serialize(no_text_date)
return date
def unserialize(self,data):

View File

@@ -76,7 +76,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
self.description = ""
self.type = EventType()
def serialize(self):
def serialize(self, no_text_date = False):
"""
Converts the data held in the event to a Python tuple that
represents all the data elements. This method is used to convert
@@ -93,7 +93,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
@rtype: tuple
"""
return (self.handle, self.gramps_id, self.type.serialize(),
DateBase.serialize(self),
DateBase.serialize(self, no_text_date),
self.description, self.place,
SourceBase.serialize(self),
NoteBase.serialize(self),