* src/GrampsDb/_GrampsDBDir.py: use types.InstanceType

* src/RelLib/_SourceBase.py: use types.InstanceType
	* src/RelLib/_Source.py: use types.InstanceType
	* src/RelLib/_MediaObject.py: use types.InstanceType
	* src/RelLib/_Person.py: use types.InstanceType
	* src/RelLib/_DateBase.py: use types.InstanceType
	* src/RelLib/_ChildRef.py: use types.InstanceType
	* src/RelLib/_Family.py: use types.InstanceType
	* src/RelLib/_Place.py: use types.InstanceType
	* src/RelLib/_RepoRef.py: use types.InstanceType
	* src/RelLib/_Note.py: use types.InstanceType
	* src/RelLib/_EventRef.py: use types.InstanceType
	* src/RelLib/_Repository.py: use types.InstanceType
	* src/RelLib/_Event.py: use types.InstanceType

2007-08-29  Don Allingham  <don@gramps-project.org>


svn: r8899
This commit is contained in:
Don Allingham
2007-08-31 01:52:24 +00:00
parent bbcf57edad
commit 3bcaf36d57
15 changed files with 59 additions and 43 deletions

View File

@@ -54,6 +54,22 @@
count filters count filters
* po/POTFILES.in: new reference count filters * po/POTFILES.in: new reference count filters
2007-08-29 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_GrampsDBDir.py: use types.InstanceType
* src/RelLib/_SourceBase.py: use types.InstanceType
* src/RelLib/_Source.py: use types.InstanceType
* src/RelLib/_MediaObject.py: use types.InstanceType
* src/RelLib/_Person.py: use types.InstanceType
* src/RelLib/_DateBase.py: use types.InstanceType
* src/RelLib/_ChildRef.py: use types.InstanceType
* src/RelLib/_Family.py: use types.InstanceType
* src/RelLib/_Place.py: use types.InstanceType
* src/RelLib/_RepoRef.py: use types.InstanceType
* src/RelLib/_Note.py: use types.InstanceType
* src/RelLib/_EventRef.py: use types.InstanceType
* src/RelLib/_Repository.py: use types.InstanceType
* src/RelLib/_Event.py: use types.InstanceType
2007-08-29 Don Allingham <don@gramps-project.org> 2007-08-29 Don Allingham <don@gramps-project.org>
* src/RelLib/_Source.py: fix fast unserialize() * src/RelLib/_Source.py: fix fast unserialize()
* src/RelLib/_Place.py: fix fast unserialize() * src/RelLib/_Place.py: fix fast unserialize()

View File

@@ -34,7 +34,7 @@ import os
import shutil import shutil
import re import re
import time import time
import new from types import InstanceType
from gettext import gettext as _ from gettext import gettext as _
from bsddb import dbshelve, db from bsddb import dbshelve, db
@@ -1095,7 +1095,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
class_func = primary_tables[primary_table_name]['class_func'] class_func = primary_tables[primary_table_name]['class_func']
while data: while data:
found_handle,val = data found_handle,val = data
obj = new.instance(class_func,None) obj = InstanceType(class_func)
obj.unserialize(val) obj.unserialize(val)
if self.UseTXN: if self.UseTXN:
@@ -1530,7 +1530,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
if data_map: if data_map:
log.error("Failed to get from handle",exc_info=True) log.error("Failed to get from handle",exc_info=True)
if data: if data:
newobj = new.instance(class_type, None) newobj = InstanceType(class_type)
newobj.unserialize(data) newobj.unserialize(data)
return newobj return newobj
return None return None

View File

@@ -26,7 +26,7 @@ Child Reference class for GRAMPS.
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -86,9 +86,9 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
SourceBase.unserialize(self, source_list) SourceBase.unserialize(self, source_list)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
RefBase.unserialize(self, ref) RefBase.unserialize(self, ref)
self.frel = new.instance(ChildRefType,None) self.frel = InstanceType(ChildRefType)
self.frel.unserialize(frel) self.frel.unserialize(frel)
self.mrel = new.instance(ChildRefType,None) self.mrel = InstanceType(ChildRefType)
self.mrel.unserialize(mrel) self.mrel.unserialize(mrel)
return self return self

View File

@@ -26,7 +26,7 @@ DateBase class for GRAMPS
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -74,7 +74,7 @@ class DateBase:
if data == None: if data == None:
self.date = Date() self.date = Date()
else: else:
self.date = new.instance(Date,None) self.date = InstanceType(Date)
self.date.unserialize(data) self.date.unserialize(data)
def get_date_object(self): def get_date_object(self):

View File

@@ -41,7 +41,7 @@ from _PlaceBase import PlaceBase
from _EventType import EventType from _EventType import EventType
from _MarkerType import MarkerType from _MarkerType import MarkerType
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -120,9 +120,9 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
source_list, note_list, media_list, attribute_list, source_list, note_list, media_list, attribute_list,
self.change, marker, self.private) = data self.change, marker, self.private) = data
self.marker = new.instance(MarkerType, None) self.marker = InstanceType(MarkerType)
self.marker.unserialize(marker) self.marker.unserialize(marker)
self.type = new.instance(EventType,None) self.type = InstanceType(EventType)
self.type.unserialize(the_type) self.type.unserialize(the_type)
DateBase.unserialize(self, date) DateBase.unserialize(self, date)
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)

View File

@@ -26,7 +26,7 @@ Event Reference class for GRAMPS
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -87,7 +87,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
AttributeBase.unserialize(self, attribute_list) AttributeBase.unserialize(self, attribute_list)
RefBase.unserialize(self, ref) RefBase.unserialize(self, ref)
self.role = new.instance(EventRoleType,None) self.role = InstanceType(EventRoleType)
self.role.unserialize(role) self.role.unserialize(role)
return self return self

View File

@@ -32,7 +32,7 @@ __revision__ = "$Revision$"
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from warnings import warn from warnings import warn
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -135,13 +135,13 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
attribute_list, lds_seal_list, source_list, note_list, attribute_list, lds_seal_list, source_list, note_list,
self.change, marker, self.private) = data self.change, marker, self.private) = data
self.marker = new.instance(MarkerType, None) self.marker = InstanceType(MarkerType)
self.marker.unserialize(marker) self.marker.unserialize(marker)
self.type = new.instance(FamilyRelType, None) self.type = InstanceType(FamilyRelType)
self.type.unserialize(the_type) self.type.unserialize(the_type)
self.event_ref_list = [new.instance(EventRef,None).unserialize(er) self.event_ref_list = [InstanceType(EventRef).unserialize(er)
for er in event_ref_list] for er in event_ref_list]
self.child_ref_list = [new.instance(ChildRef,None).unserialize(cr) self.child_ref_list = [InstanceType(ChildRef).unserialize(cr)
for cr in child_ref_list] for cr in child_ref_list]
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)
AttributeBase.unserialize(self, attribute_list) AttributeBase.unserialize(self, attribute_list)

View File

@@ -32,7 +32,7 @@ __revision__ = "$Revision$"
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -119,7 +119,7 @@ class MediaObject(SourceBase,NoteBase,DateBase,AttributeBase,PrimaryObject):
attribute_list, source_list, note_list, self.change, attribute_list, source_list, note_list, self.change,
date, marker, self.private) = data date, marker, self.private) = data
self.marker = new.instance(MarkerType, None) self.marker = InstanceType(MarkerType)
self.marker.unserialize(marker) self.marker.unserialize(marker)
AttributeBase.unserialize(self, attribute_list) AttributeBase.unserialize(self, attribute_list)
SourceBase.unserialize(self, source_list) SourceBase.unserialize(self, source_list)

View File

@@ -32,7 +32,7 @@ __revision__ = "$Revision$"
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import re import re
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -85,9 +85,9 @@ class Note(BasicPrimaryObject):
(self.handle, self.gramps_id, self.text, self.format, (self.handle, self.gramps_id, self.text, self.format,
the_type, self.change, the_marker, self.private) = data the_type, self.change, the_marker, self.private) = data
self.marker = new.instance(MarkerType, None) self.marker = InstanceType(MarkerType)
self.marker.unserialize(the_marker) self.marker.unserialize(the_marker)
self.type = new.instance(NoteType, None) self.type = InstanceType(NoteType)
self.type.unserialize(the_type) self.type.unserialize(the_type)
def get_text_data_list(self): def get_text_data_list(self):

View File

@@ -26,7 +26,7 @@ Person object for GRAMPS
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -184,15 +184,15 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
person_ref_list, # 20 person_ref_list, # 20
) = data ) = data
self.marker = new.instance(MarkerType,None) self.marker = InstanceType(MarkerType)
self.marker.unserialize(marker) self.marker.unserialize(marker)
self.primary_name = new.instance(Name, None) self.primary_name = InstanceType(Name)
self.primary_name.unserialize(primary_name) self.primary_name.unserialize(primary_name)
self.alternate_names = [new.instance(Name, None).unserialize(name) self.alternate_names = [InstanceType(Name).unserialize(name)
for name in alternate_names] for name in alternate_names]
self.event_ref_list = [new.instance(EventRef, None).unserialize(er) self.event_ref_list = [InstanceType(EventRef).unserialize(er)
for er in event_ref_list] for er in event_ref_list]
self.person_ref_list = [new.instance(PersonRef, None).unserialize(pr) self.person_ref_list = [InstanceType(PersonRef).unserialize(pr)
for pr in person_ref_list] for pr in person_ref_list]
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)
LdsOrdBase.unserialize(self, lds_ord_list) LdsOrdBase.unserialize(self, lds_ord_list)

View File

@@ -26,7 +26,7 @@ Place object for GRAMPS
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -126,10 +126,10 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
if main_loc == None: if main_loc == None:
self.main_loc = None self.main_loc = None
else: else:
self.main_loc = new.instance(Location, None).unserialize(main_loc) self.main_loc = InstanceType(Location).unserialize(main_loc)
self.alt_loc = [new.instance(Location, None).unserialize(al) self.alt_loc = [InstanceType(Location).unserialize(al)
for al in alt_loc] for al in alt_loc]
self.marker = new.instance(MarkerType, None) self.marker = InstanceType(MarkerType)
self.marker.unserialize(marker) self.marker.unserialize(marker)
UrlBase.unserialize(self, urls) UrlBase.unserialize(self, urls)
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)

View File

@@ -26,7 +26,7 @@ Repository Reference class for GRAMPS
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -76,7 +76,7 @@ class RepoRef(SecondaryObject, PrivacyBase, NoteBase, RefBase):
Converts a serialized tuple of data to an object Converts a serialized tuple of data to an object
""" """
(note_list, ref, self.call_number, media_type, privacy) = data (note_list, ref, self.call_number, media_type, privacy) = data
self.media_type = new.instance(SourceMediaType, None) self.media_type = InstanceType(SourceMediaType)
self.media_type.unserialize(media_type) self.media_type.unserialize(media_type)
PrivacyBase.unserialize(self, privacy) PrivacyBase.unserialize(self, privacy)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)

View File

@@ -26,7 +26,7 @@ Repository object for GRAMPS
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -76,9 +76,9 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
(self.handle, self.gramps_id, the_type, self.name, note_list, (self.handle, self.gramps_id, the_type, self.name, note_list,
address_list, urls, self.change, marker, self.private) = data address_list, urls, self.change, marker, self.private) = data
self.marker = new.instance(MarkerType, None) self.marker = InstanceType(MarkerType)
self.marker.unserialize(marker) self.marker.unserialize(marker)
self.type = new.instance(RepositoryType, None) self.type = InstanceType(RepositoryType)
self.type.unserialize(the_type) self.type.unserialize(the_type)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
AddressBase.unserialize(self, address_list) AddressBase.unserialize(self, address_list)

View File

@@ -26,7 +26,7 @@ Source object for GRAMPS
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -82,11 +82,11 @@ class Source(MediaBase, NoteBase, PrimaryObject):
self.abbrev, self.change, self.datamap, reporef_list, self.abbrev, self.change, self.datamap, reporef_list,
marker, self.private) = data marker, self.private) = data
self.marker = new.instance(MarkerType, None) self.marker = InstanceType(MarkerType)
self.marker.unserialize(marker) self.marker.unserialize(marker)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)
self.reporef_list = [new.instance(RepoRef, None).unserialize(rr) self.reporef_list = [InstanceType(RepoRef).unserialize(rr)
for rr in reporef_list] for rr in reporef_list]
def _has_handle_reference(self, classname, handle): def _has_handle_reference(self, classname, handle):

View File

@@ -26,7 +26,7 @@ SourceBase class for GRAMPS
__revision__ = "$Revision$" __revision__ = "$Revision$"
import new from types import InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -67,7 +67,7 @@ class SourceBase:
""" """
Converts a serialized tuple of data to an object Converts a serialized tuple of data to an object
""" """
self.source_list = [new.instance(SourceRef, None).unserialize(item) self.source_list = [InstanceType(SourceRef).unserialize(item)
for item in data] for item in data]
def add_source_reference(self, src_ref) : def add_source_reference(self, src_ref) :