From 232e32b2c13ce45096c1333240e4bc8b6c6a21a7 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 20 Apr 2006 18:20:55 +0000 Subject: [PATCH] 2006-04-20 Alex Roitman * src/RelLib/_EventRef.py (unserialize): Avoid class constructor. * src/RelLib/_Person.py (unserialize): Avoid class constructor. * src/RelLib/_Name.py (unserialize): Avoid class constructor. * src/RelLib/_Repository.py (unserialize): Avoid class constructor. * src/RelLib/_RepoRef.py (unserialize): Avoid class constructor. * src/GrampsDb/_WriteXML.py: Update to export new types. svn: r6382 --- ChangeLog | 8 ++++++++ src/GrampsDb/_WriteXML.py | 13 +++++-------- src/RelLib/_EventRef.py | 2 +- src/RelLib/_Name.py | 2 +- src/RelLib/_Person.py | 2 +- src/RelLib/_RepoRef.py | 2 +- src/RelLib/_Repository.py | 2 +- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d62bbd3c..6fd12375e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-04-20 Alex Roitman + * src/RelLib/_EventRef.py (unserialize): Avoid class constructor. + * src/RelLib/_Person.py (unserialize): Avoid class constructor. + * src/RelLib/_Name.py (unserialize): Avoid class constructor. + * src/RelLib/_Repository.py (unserialize): Avoid class constructor. + * src/RelLib/_RepoRef.py (unserialize): Avoid class constructor. + * src/GrampsDb/_WriteXML.py: Update to export new types. + 2006-04-19 Alex Roitman * src/Editors/_EditPrimary.py (EditPrimary.build_window_key): Always have a window key, even if there is no handle. diff --git a/src/GrampsDb/_WriteXML.py b/src/GrampsDb/_WriteXML.py index f92a48bae..c93b5af35 100644 --- a/src/GrampsDb/_WriteXML.py +++ b/src/GrampsDb/_WriteXML.py @@ -549,7 +549,7 @@ class XmlWriter: return sp = " "*index priv_text = conf_priv(eventref) - role = _ConstXML.str_for_xml(_ConstXML.event_roles,eventref.role) + role = eventref.role.xml_str() if role: role_text = ' role="%s"' % role else: @@ -571,7 +571,7 @@ class XmlWriter: self.write_primary_tag("event",event,2) sp = " " * index - etype = _ConstXML.str_for_xml(_ConstXML.events,event.get_type()) + etype = event.get_type().xml_str() self.g.write(' %s%s\n' % (sp,self.fix(etype)) ) self.write_date(event.get_date_object(),index+1) self.write_ref("place",event.get_place_handle(),index+1) @@ -645,8 +645,7 @@ class XmlWriter: if not obj: return sp = " "*index - marker = _ConstXML.str_for_xml(_ConstXML.marker_types, - obj.get_marker()) + marker = obj.get_marker().xml_str() if marker: marker_text = ' marker="%s"' % marker else: @@ -663,8 +662,7 @@ class XmlWriter: sp = " "*index self.write_primary_tag('family',family,index) if family: - rel = _ConstXML.str_for_xml(_ConstXML.family_relations, - family.get_relationship()) + rel = family.get_relationship().xml_str() if rel != "": self.g.write(' %s\n' % (sp,rel) ) @@ -902,8 +900,7 @@ class XmlWriter: else: callno_text = ' callno="%s"' % reporef.call_number - mtype = _ConstXML.str_for_xml(_ConstXML.source_media_types, - reporef.media_type) + mtype = reporef.media_type.xml_str() if mtype: type_text = ' medium="%s"' % mtype else: diff --git a/src/RelLib/_EventRef.py b/src/RelLib/_EventRef.py index 0d910219e..6af6adb63 100644 --- a/src/RelLib/_EventRef.py +++ b/src/RelLib/_EventRef.py @@ -81,7 +81,7 @@ class EventRef(BaseObject,PrivacyBase,NoteBase,RefBase): PrivacyBase.unserialize(self,privacy) NoteBase.unserialize(self,note) RefBase.unserialize(self,ref) - self.role = EventRoleType(role) + self.role.unserialize(role) return self def get_text_data_list(self): diff --git a/src/RelLib/_Name.py b/src/RelLib/_Name.py index 236fa1a65..edba844c5 100644 --- a/src/RelLib/_Name.py +++ b/src/RelLib/_Name.py @@ -121,7 +121,7 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase): self.first_name,self.surname,self.suffix,self.title, name_type,self.prefix,self.patronymic,self.sname, self.group_as,self.sort_as,self.display_as) = data - self.type = NameType(name_type) + self.type.unserialize(name_type) PrivacyBase.unserialize(self,privacy) SourceBase.unserialize(self,source_list) NoteBase.unserialize(self,note) diff --git a/src/RelLib/_Person.py b/src/RelLib/_Person.py index 965a0c5d2..16d0ea550 100644 --- a/src/RelLib/_Person.py +++ b/src/RelLib/_Person.py @@ -201,7 +201,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase, person_ref_list, # 21 ) = data - self.marker = MarkerType(marker) + self.marker.unserialize(marker) self.primary_name.unserialize(primary_name) if death_ref: self.death_ref = EventRef().unserialize(death_ref) diff --git a/src/RelLib/_RepoRef.py b/src/RelLib/_RepoRef.py index 8899e8202..4125a3098 100644 --- a/src/RelLib/_RepoRef.py +++ b/src/RelLib/_RepoRef.py @@ -63,7 +63,7 @@ class RepoRef(BaseObject,NoteBase,RefBase): def unserialize(self,data): (note,ref,self.call_number,media_type) = data - self.media_type = SourceMediaType(media_type) + self.media_type.unserialize(media_type) NoteBase.unserialize(self,note) RefBase.unserialize(self,ref) return self diff --git a/src/RelLib/_Repository.py b/src/RelLib/_Repository.py index af64f2d05..7a33d4786 100644 --- a/src/RelLib/_Repository.py +++ b/src/RelLib/_Repository.py @@ -75,7 +75,7 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase): (self.handle, self.gramps_id, the_type, self.name, note, address_list, urls ,self.marker, self.private) = data - self.type = RepositoryType(the_type) + self.type.unserialize(the_type) NoteBase.unserialize(self,note) AddressBase.unserialize(self,address_list) UrlBase.unserialize(self,urls)