* src/GrampsBSDDB.py (gramps_upgrade_9): Upgrade witness list in
the old Event object. * src/RelLib/_Event.py: Remove external witnesses altogether. * src/RelLib/_Witness.py: Make even emptier (needed for upgrade only). * src/RelLib/__init__.py: Expose Witness (needed for upgrade only). svn: r5595
This commit is contained in:
parent
793b6ba8b5
commit
4c26af4eea
@ -3,6 +3,12 @@
|
|||||||
* src/RelLib/Makefile.am: Ship new files;
|
* src/RelLib/Makefile.am: Ship new files;
|
||||||
* src/RelLib/ various files: add more files.
|
* src/RelLib/ various files: add more files.
|
||||||
|
|
||||||
|
* src/GrampsBSDDB.py (gramps_upgrade_9): Upgrade witness list in
|
||||||
|
the old Event object.
|
||||||
|
* src/RelLib/_Event.py: Remove external witnesses altogether.
|
||||||
|
* src/RelLib/_Witness.py: Make even emptier (needed for upgrade only).
|
||||||
|
* src/RelLib/__init__.py: Expose Witness (needed for upgrade only).
|
||||||
|
|
||||||
2005-12-20 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2005-12-20 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/RelLib/_helper.py: removed get_backlink_handles
|
* src/RelLib/_helper.py: removed get_backlink_handles
|
||||||
* test/RelLib_Test.py: removed test for get_backlink_handles
|
* test/RelLib_Test.py: removed test for get_backlink_handles
|
||||||
|
@ -1042,25 +1042,21 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
# Change every event handle to the EventRef
|
# Change every event handle to the EventRef
|
||||||
if birth_handle:
|
if birth_handle:
|
||||||
event_ref = EventRef()
|
event_ref = EventRef()
|
||||||
event_ref.set_reference_handle(birth_handle)
|
event_ref.ref = birth_handle
|
||||||
event_ref.set_role((EventRef.PRIMARY,''))
|
event_ref.role = (EventRef.PRIMARY,'')
|
||||||
person.birth_ref = event_ref
|
person.birth_ref = event_ref
|
||||||
|
|
||||||
if death_handle:
|
if death_handle:
|
||||||
event_ref = EventRef()
|
event_ref = EventRef()
|
||||||
event_ref.set_reference_handle(death_handle)
|
event_ref.ref = death_handle
|
||||||
event_ref.set_role((EventRef.PRIMARY,''))
|
event_ref.role = (EventRef.PRIMARY,'')
|
||||||
person.death_ref = event_ref
|
person.death_ref = event_ref
|
||||||
|
|
||||||
event_ref_list = []
|
|
||||||
for event_handle in event_list:
|
for event_handle in event_list:
|
||||||
event_ref = EventRef()
|
event_ref = EventRef()
|
||||||
event_ref.set_reference_handle(event_handle)
|
event_ref.ref = event_handle
|
||||||
event_ref.set_role((EventRef.PRIMARY,''))
|
event_ref.role = (EventRef.PRIMARY,'')
|
||||||
event_ref_list.append(event_ref)
|
person.event_ref_list.append(event_ref)
|
||||||
|
|
||||||
if event_ref_list:
|
|
||||||
person.event_ref_list = event_ref_list[:]
|
|
||||||
|
|
||||||
# In all Name instances, convert type from string to a tuple
|
# In all Name instances, convert type from string to a tuple
|
||||||
name_conversion = {
|
name_conversion = {
|
||||||
@ -1114,14 +1110,11 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
family.marker = (PrimaryObject.MARKER_COMPLETE,"")
|
family.marker = (PrimaryObject.MARKER_COMPLETE,"")
|
||||||
|
|
||||||
# Change every event handle to the EventRef
|
# Change every event handle to the EventRef
|
||||||
event_ref_list = []
|
|
||||||
for event_handle in event_list:
|
for event_handle in event_list:
|
||||||
event_ref = EventRef()
|
event_ref = EventRef()
|
||||||
event_ref.set_reference_handle(event_handle)
|
event_ref.ref = event_handle
|
||||||
event_ref.set_role((EventRef.PRIMARY,''))
|
event_ref.role = (EventRef.PRIMARY,'')
|
||||||
event_ref_list.append(event_ref)
|
family.event_ref_list.append(event_ref)
|
||||||
if event_ref_list:
|
|
||||||
family.event_ref_list = event_ref_list[:]
|
|
||||||
|
|
||||||
# In all Attributes, convert type from string to a tuple
|
# In all Attributes, convert type from string to a tuple
|
||||||
for attribute in family.attribute_list:
|
for attribute in family.attribute_list:
|
||||||
@ -1183,7 +1176,6 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
"Will" : (Event.WILL,""),
|
"Will" : (Event.WILL,""),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove Witness from every event and convert name to type
|
|
||||||
# cursor = self.get_event_cursor()
|
# cursor = self.get_event_cursor()
|
||||||
# data = cursor.first()
|
# data = cursor.first()
|
||||||
# while data:
|
# while data:
|
||||||
@ -1194,8 +1186,8 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
event.handle = handle
|
event.handle = handle
|
||||||
(junk_handle, event.gramps_id, old_type, event.date,
|
(junk_handle, event.gramps_id, old_type, event.date,
|
||||||
event.description, event.place, event.cause, event.private,
|
event.description, event.place, event.cause, event.private,
|
||||||
event.source_list, event.note, witness, event.media_list,
|
event.source_list, event.note, witness_list,
|
||||||
event.change) = info
|
event.media_list, event.change) = info
|
||||||
|
|
||||||
if old_type:
|
if old_type:
|
||||||
if event_conversion.has_key(old_type):
|
if event_conversion.has_key(old_type):
|
||||||
@ -1210,6 +1202,27 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
for media_ref in event.media_list:
|
for media_ref in event.media_list:
|
||||||
convert_mediaref_9(media_ref)
|
convert_mediaref_9(media_ref)
|
||||||
|
|
||||||
|
# Upgrade witness -- no more Witness class
|
||||||
|
if type(witness_list) != list:
|
||||||
|
witness_list = []
|
||||||
|
for witness in witness_list:
|
||||||
|
if witness.type == 0: # witness name recorded
|
||||||
|
# Add name and comment to the event note
|
||||||
|
note_text = event.get_note() + "\n" + \
|
||||||
|
_("Witness name: %s") % witness.val
|
||||||
|
if witness.comment:
|
||||||
|
note_text += "\n" + _("Wittness comment: %s") \
|
||||||
|
% witness.comment
|
||||||
|
event.set_note(note_text)
|
||||||
|
elif witness.type == 1: # witness ID recorded
|
||||||
|
# Add an EventRef from that person
|
||||||
|
# to this event using ROLE_WITNESS role
|
||||||
|
event_ref = EventRef()
|
||||||
|
event_ref.ref = event.handle
|
||||||
|
event_ref.role = (EventRef.WITNESS,'')
|
||||||
|
person = self.get_person_from_handle(witness.val)
|
||||||
|
person.event_ref_list.append(event_ref)
|
||||||
|
self.commit_person(person,trans)
|
||||||
self.commit_event(event,trans)
|
self.commit_event(event,trans)
|
||||||
# data = cursor.next()
|
# data = cursor.next()
|
||||||
# cursor.close()
|
# cursor.close()
|
||||||
|
@ -121,12 +121,10 @@ class Event(PrimaryObject,SourceNote,MediaBase,DateBase,PlaceBase):
|
|||||||
self.description = source.description
|
self.description = source.description
|
||||||
self.type = source.type
|
self.type = source.type
|
||||||
self.cause = source.cause
|
self.cause = source.cause
|
||||||
self.ext_witness_list = source.ext_witness_list
|
|
||||||
else:
|
else:
|
||||||
self.description = ""
|
self.description = ""
|
||||||
self.type = (Event.CUSTOM,"")
|
self.type = (Event.CUSTOM,"")
|
||||||
self.cause = ""
|
self.cause = ""
|
||||||
self.ext_witness_list = []
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
"""
|
"""
|
||||||
@ -145,9 +143,9 @@ class Event(PrimaryObject,SourceNote,MediaBase,DateBase,PlaceBase):
|
|||||||
@rtype: tuple
|
@rtype: tuple
|
||||||
"""
|
"""
|
||||||
return (self.handle, self.gramps_id, self.type, self.date,
|
return (self.handle, self.gramps_id, self.type, self.date,
|
||||||
self.description, self.place, self.cause, self.private,
|
self.description, self.place, self.cause,
|
||||||
self.source_list, self.note, self.media_list, self.change,
|
self.source_list, self.note, self.media_list,
|
||||||
self.marker, self.private)
|
self.change, self.marker, self.private)
|
||||||
|
|
||||||
def unserialize(self,data):
|
def unserialize(self,data):
|
||||||
"""
|
"""
|
||||||
@ -159,9 +157,8 @@ class Event(PrimaryObject,SourceNote,MediaBase,DateBase,PlaceBase):
|
|||||||
@type data: tuple
|
@type data: tuple
|
||||||
"""
|
"""
|
||||||
(self.handle, self.gramps_id, self.type, self.date,
|
(self.handle, self.gramps_id, self.type, self.date,
|
||||||
self.description, self.place, self.cause, self.private,
|
self.description, self.place, self.cause, self.source_list, self.note,
|
||||||
self.source_list, self.note, self.media_list, self.change,
|
self.media_list, self.change, self.marker, self.private) = data
|
||||||
self.marker, self.private) = data
|
|
||||||
|
|
||||||
def _has_handle_reference(self,classname,handle):
|
def _has_handle_reference(self,classname,handle):
|
||||||
if classname == 'Place':
|
if classname == 'Place':
|
||||||
@ -356,20 +353,3 @@ class Event(PrimaryObject,SourceNote,MediaBase,DateBase,PlaceBase):
|
|||||||
@rtype: str
|
@rtype: str
|
||||||
"""
|
"""
|
||||||
return self.description
|
return self.description
|
||||||
|
|
||||||
def add_ext_witness(self,witness):
|
|
||||||
assert type(witness) == tuple
|
|
||||||
self.ext_witness_list.append(witness)
|
|
||||||
|
|
||||||
def remove_ext_witness(self,witness):
|
|
||||||
assert type(witness) == tuple
|
|
||||||
if witness in self.ext_witness_list:
|
|
||||||
self.ext_witness_list.remove(witness)
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def get_ext_witness_list(self):
|
|
||||||
return self.ext_witness_list
|
|
||||||
|
|
||||||
def set_ext_witness_list(self,witness_list):
|
|
||||||
self.ext_witness_list = witness_list
|
|
||||||
|
@ -29,7 +29,7 @@ Witness class for GRAMPS
|
|||||||
# Witness class
|
# Witness class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Witness(BaseObject,PrivacyBase):
|
class Witness:
|
||||||
# FIXME: this class is only present to enable db upgrade
|
# FIXME: this class is only present to enable db upgrade
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@ -37,6 +37,7 @@ from _Note import Note
|
|||||||
from _RepoRef import RepoRef
|
from _RepoRef import RepoRef
|
||||||
from _SourceRef import SourceRef
|
from _SourceRef import SourceRef
|
||||||
from _Url import Url
|
from _Url import Url
|
||||||
|
from _Witness import Witness
|
||||||
|
|
||||||
# Primary objects
|
# Primary objects
|
||||||
from _PrimaryObject import PrimaryObject
|
from _PrimaryObject import PrimaryObject
|
||||||
|
Loading…
Reference in New Issue
Block a user