2006-08-14 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_10): Add an upgrade path from 2.1.91. * src/RelLib/_AttributeType.py: Add new attribute types for events and event references. * src/RelLib/_EventRef.py: Add attribute list. * src/RelLib/_Event.py: Add attribute list. svn: r7180
This commit is contained in:
		| @@ -1,3 +1,11 @@ | |||||||
|  | 2006-08-14  Alex Roitman  <shura@gramps-project.org> | ||||||
|  | 	* src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_10): Add an upgrade | ||||||
|  | 	path from 2.1.91. | ||||||
|  | 	* src/RelLib/_AttributeType.py: Add new attribute types for events | ||||||
|  | 	and event references. | ||||||
|  | 	* src/RelLib/_EventRef.py: Add attribute list. | ||||||
|  | 	* src/RelLib/_Event.py: Add attribute list. | ||||||
|  |  | ||||||
| 2006-08-14  Brian Matherly  <brian@gramps-project.org> | 2006-08-14  Brian Matherly  <brian@gramps-project.org> | ||||||
| 	* src/gramps.py: mask strange Windows logging error on close | 	* src/gramps.py: mask strange Windows logging error on close | ||||||
|  |  | ||||||
|   | |||||||
| @@ -59,7 +59,7 @@ import Errors | |||||||
| from BasicUtils import UpdateCallback | from BasicUtils import UpdateCallback | ||||||
|  |  | ||||||
| _MINVERSION = 5 | _MINVERSION = 5 | ||||||
| _DBVERSION = 9 | _DBVERSION = 10 | ||||||
|  |  | ||||||
| def find_surname(key,data): | def find_surname(key,data): | ||||||
|     return str(data[3][5]) |     return str(data[3][5]) | ||||||
| @@ -1403,6 +1403,8 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): | |||||||
|             self.gramps_upgrade_8() |             self.gramps_upgrade_8() | ||||||
|         if version < 9: |         if version < 9: | ||||||
|             self.gramps_upgrade_9() |             self.gramps_upgrade_9() | ||||||
|  |         if version < 10: | ||||||
|  |             self.gramps_upgrade_10() | ||||||
|         print "Upgrade time:", int(time.time()-t), "seconds" |         print "Upgrade time:", int(time.time()-t), "seconds" | ||||||
|  |  | ||||||
|     def gramps_upgrade_6(self): |     def gramps_upgrade_6(self): | ||||||
| @@ -1865,6 +1867,155 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): | |||||||
|  |  | ||||||
|         print "Done upgrading to DB version 9" |         print "Done upgrading to DB version 9" | ||||||
|  |  | ||||||
|  |     def gramps_upgrade_10(self): | ||||||
|  |         print "Upgrading to DB version 10 -- this may take a while" | ||||||
|  |  | ||||||
|  |         # Create one secondary index for reference_map | ||||||
|  |         # because every commit will require this to exist | ||||||
|  |         table_flags = self.open_flags() | ||||||
|  |         self.reference_map_primary_map = db.DB(self.env) | ||||||
|  |         self.reference_map_primary_map.set_flags(db.DB_DUP) | ||||||
|  |         self.reference_map_primary_map.open(self.full_name, | ||||||
|  |                                             "reference_map_primary_map", | ||||||
|  |                                             db.DB_BTREE, flags=table_flags) | ||||||
|  |         self.reference_map.associate(self.reference_map_primary_map, | ||||||
|  |                                      find_primary_handle, | ||||||
|  |                                      table_flags) | ||||||
|  |  | ||||||
|  |         # so starting (batch) transaction here. | ||||||
|  |         trans = self.transaction_begin("",True) | ||||||
|  |  | ||||||
|  |         # Import secondary modules from RelLib | ||||||
|  |         from RelLib._DateBase import DateBase | ||||||
|  |         from RelLib._MediaBase import MediaBase | ||||||
|  |         from RelLib._SourceBase import SourceBase | ||||||
|  |         from RelLib._NoteBase import NoteBase | ||||||
|  |         from RelLib._LdsOrdBase import LdsOrdBase | ||||||
|  |         from RelLib._AddressBase import AddressBase | ||||||
|  |         from RelLib._AttributeBase import AttributeBase | ||||||
|  |         from RelLib._UrlBase import UrlBase | ||||||
|  |         from RelLib._PrivacyBase import PrivacyBase | ||||||
|  |         from RelLib._RefBase import RefBase | ||||||
|  |  | ||||||
|  |         # This upgrade adds attribute lists to Event and EventRef objects | ||||||
|  |         self.set_total(self.get_number_of_events()) | ||||||
|  |  | ||||||
|  |         for handle in self.event_map.keys(): | ||||||
|  |             info = self.event_map[handle]         | ||||||
|  |             event = Event() | ||||||
|  |             event.handle = handle | ||||||
|  |             (junk_handle, event.gramps_id, the_type, date, | ||||||
|  |              event.description, event.place, cause,  | ||||||
|  |              source_list, note, media_list, | ||||||
|  |              event.change, marker, event.private) = info | ||||||
|  |  | ||||||
|  |             event.marker.unserialize(marker) | ||||||
|  |             event.type.unserialize(the_type) | ||||||
|  |             DateBase.unserialize(event,date) | ||||||
|  |             MediaBase.unserialize(event,media_list) | ||||||
|  |             SourceBase.unserialize(event,source_list) | ||||||
|  |             NoteBase.unserialize(event,note)         | ||||||
|  |  | ||||||
|  |             if cause.strip(): | ||||||
|  |                 attr = Attribute() | ||||||
|  |                 attr.set_type(AttributeType.CAUSE) | ||||||
|  |                 attr.set_value(cause) | ||||||
|  |                 event.add_attribute(attr) | ||||||
|  |  | ||||||
|  |             self.commit_event(event,trans) | ||||||
|  |             self.update() | ||||||
|  |         self.reset() | ||||||
|  |  | ||||||
|  |         # Personal event references | ||||||
|  |         self.set_total(len(self.person_map)) | ||||||
|  |         for handle in self.person_map.keys(): | ||||||
|  |             info = self.person_map[handle] | ||||||
|  |             person = Person() | ||||||
|  |             person.handle = handle | ||||||
|  |             (junk_handle,person.gramps_id,person.gender, | ||||||
|  |              primary_name,alternate_names,person.death_ref_index, | ||||||
|  |              person.birth_ref_index,event_ref_list,person.family_list, | ||||||
|  |              person.parent_family_list,media_list,address_list,attribute_list, | ||||||
|  |              urls,lds_ord_list,source_list,note,person.change,marker, | ||||||
|  |              person.private,person_ref_list,) = info | ||||||
|  |  | ||||||
|  |             person.marker.unserialize(marker) | ||||||
|  |             person.primary_name.unserialize(primary_name) | ||||||
|  |             person.alternate_names = [Name().unserialize(name) | ||||||
|  |                                       for name in alternate_names] | ||||||
|  |             person.person_ref_list = [PersonRef().unserialize(pr) | ||||||
|  |                                       for pr in person_ref_list] | ||||||
|  |             MediaBase.unserialize(person, media_list) | ||||||
|  |             LdsOrdBase.unserialize(person, lds_ord_list) | ||||||
|  |             AddressBase.unserialize(person, address_list) | ||||||
|  |             AttributeBase.unserialize(person, attribute_list) | ||||||
|  |             UrlBase.unserialize(person, urls) | ||||||
|  |             SourceBase.unserialize(person, source_list) | ||||||
|  |             NoteBase.unserialize(person, note) | ||||||
|  |          | ||||||
|  |             for (privacy,note,ref,role) in event_ref_list: | ||||||
|  |                 event_ref = EventRef() | ||||||
|  |                 PrivacyBase.unserialize(event_ref,privacy) | ||||||
|  |                 NoteBase.unserialize(event_ref,note) | ||||||
|  |                 RefBase.unserialize(event_ref,ref) | ||||||
|  |                 event_ref.role.unserialize(role) | ||||||
|  |                 person.add_event_ref(event_ref) | ||||||
|  |  | ||||||
|  |             self.commit_person(person,trans) | ||||||
|  |             self.update() | ||||||
|  |         self.reset() | ||||||
|  |          | ||||||
|  |         # Family event references | ||||||
|  |         self.set_total(self.get_number_of_families()) | ||||||
|  |         for handle in self.family_map.keys(): | ||||||
|  |             info = self.family_map[handle] | ||||||
|  |             family = Family() | ||||||
|  |             family.handle = handle | ||||||
|  |  | ||||||
|  |             (junk_handle,family.gramps_id,family.father_handle, | ||||||
|  |              family.mother_handle,child_ref_list,the_type,event_ref_list, | ||||||
|  |              media_list,attribute_list,lds_seal_list,source_list,note, | ||||||
|  |              family.change, marker, family.private) = info | ||||||
|  |  | ||||||
|  |             family.marker.unserialize(marker) | ||||||
|  |             family.type.unserialize(the_type) | ||||||
|  |             family.child_ref_list = [ChildRef().unserialize(cr) | ||||||
|  |                                      for cr in child_ref_list] | ||||||
|  |             MediaBase.unserialize(family,media_list) | ||||||
|  |             AttributeBase.unserialize(family,attribute_list) | ||||||
|  |             SourceBase.unserialize(family,source_list) | ||||||
|  |             NoteBase.unserialize(family,note) | ||||||
|  |             LdsOrdBase.unserialize(family,lds_seal_list) | ||||||
|  |  | ||||||
|  |             for (privacy,note,ref,role) in event_ref_list: | ||||||
|  |                 event_ref = EventRef() | ||||||
|  |                 PrivacyBase.unserialize(event_ref,privacy) | ||||||
|  |                 NoteBase.unserialize(event_ref,note) | ||||||
|  |                 RefBase.unserialize(event_ref,ref) | ||||||
|  |                 event_ref.role.unserialize(role) | ||||||
|  |                 family.add_event_ref(event_ref) | ||||||
|  |  | ||||||
|  |             self.commit_family(family,trans) | ||||||
|  |             self.update() | ||||||
|  |         self.reset() | ||||||
|  |  | ||||||
|  |         self.transaction_commit(trans,"Upgrade to DB version 10") | ||||||
|  |         # Close secodnary index | ||||||
|  |         self.reference_map_primary_map.close() | ||||||
|  |  | ||||||
|  |         if self.UseTXN: | ||||||
|  |             # Separate transaction to save metadata | ||||||
|  |             the_txn = self.env.txn_begin() | ||||||
|  |         else: | ||||||
|  |             the_txn = None | ||||||
|  |         self.metadata.put('version',10,txn=the_txn) | ||||||
|  |         if self.UseTXN: | ||||||
|  |             the_txn.commit() | ||||||
|  |         else: | ||||||
|  |             self.metadata.sync() | ||||||
|  |  | ||||||
|  |         print "Done upgrading to DB version 10" | ||||||
|  |  | ||||||
| class BdbTransaction(Transaction): | class BdbTransaction(Transaction): | ||||||
|     def __init__(self,msg,db,batch=False,no_magic=False): |     def __init__(self,msg,db,batch=False,no_magic=False): | ||||||
|         Transaction.__init__(self,msg,db,batch,no_magic) |         Transaction.__init__(self,msg,db,batch,no_magic) | ||||||
|   | |||||||
| @@ -34,6 +34,11 @@ class AttributeType(GrampsType): | |||||||
|     NUM_CHILD   = 5 |     NUM_CHILD   = 5 | ||||||
|     SSN         = 6 |     SSN         = 6 | ||||||
|     NICKNAME    = 7 |     NICKNAME    = 7 | ||||||
|  |     CAUSE       = 8 | ||||||
|  |     AGENCY      = 9 | ||||||
|  |     AGE         = 10 | ||||||
|  |     FATHER_AGE  = 11 | ||||||
|  |     MOTHER_AGE  = 12 | ||||||
|  |  | ||||||
|     _CUSTOM = CUSTOM |     _CUSTOM = CUSTOM | ||||||
|     _DEFAULT = ID |     _DEFAULT = ID | ||||||
| @@ -49,6 +54,11 @@ class AttributeType(GrampsType): | |||||||
|         (SSN         , _("Social Security Number"), "Social Security Number"), |         (SSN         , _("Social Security Number"), "Social Security Number"), | ||||||
|         (NUM_CHILD   , _("Number of Children"), "Number of Children"), |         (NUM_CHILD   , _("Number of Children"), "Number of Children"), | ||||||
|         (NICKNAME    , _("Nickname"), "Nickname"), |         (NICKNAME    , _("Nickname"), "Nickname"), | ||||||
|  |         (CAUSE       , _("Cause"), "Cause"), | ||||||
|  |         (AGENCY      , _("Agency"), "Agency"), | ||||||
|  |         (AGE         , _("Age"), "Age"), | ||||||
|  |         (FATHER_AGE  , _("Father's Age"), "Father Age"), | ||||||
|  |         (MOTHER_AGE  , _("Mother's Age"), "Mother Age"), | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|     _I2SMAP = init_map(_DATAMAP, 0, 1) |     _I2SMAP = init_map(_DATAMAP, 0, 1) | ||||||
|   | |||||||
| @@ -33,6 +33,7 @@ from _PrimaryObject import PrimaryObject | |||||||
| from _SourceBase import SourceBase | from _SourceBase import SourceBase | ||||||
| from _NoteBase import NoteBase | from _NoteBase import NoteBase | ||||||
| from _MediaBase import MediaBase | from _MediaBase import MediaBase | ||||||
|  | from _AttributeBase import AttributeBase | ||||||
| from _DateBase import DateBase | from _DateBase import DateBase | ||||||
| from _PlaceBase import PlaceBase | from _PlaceBase import PlaceBase | ||||||
| from _EventType import EventType | from _EventType import EventType | ||||||
| @@ -42,7 +43,8 @@ from _EventType import EventType | |||||||
| # Event class | # Event class | ||||||
| # | # | ||||||
| #------------------------------------------------------------------------- | #------------------------------------------------------------------------- | ||||||
| class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase, | ||||||
|  |             DateBase,PlaceBase): | ||||||
|     """ |     """ | ||||||
|     Introduction |     Introduction | ||||||
|     ============ |     ============ | ||||||
| @@ -63,17 +65,16 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|         SourceBase.__init__(self,source) |         SourceBase.__init__(self,source) | ||||||
|         NoteBase.__init__(self,source) |         NoteBase.__init__(self,source) | ||||||
|         MediaBase.__init__(self,source) |         MediaBase.__init__(self,source) | ||||||
|  |         AttributeBase.__init__(self) | ||||||
|         DateBase.__init__(self,source) |         DateBase.__init__(self,source) | ||||||
|         PlaceBase.__init__(self,source) |         PlaceBase.__init__(self,source) | ||||||
|  |  | ||||||
|         if source: |         if source: | ||||||
|             self.description = source.description |             self.description = source.description | ||||||
|             self.type = source.type |             self.type = source.type | ||||||
|             self.cause = source.cause |  | ||||||
|         else: |         else: | ||||||
|             self.description = "" |             self.description = "" | ||||||
|             self.type = EventType() |             self.type = EventType() | ||||||
|             self.cause = "" |  | ||||||
|  |  | ||||||
|     def serialize(self): |     def serialize(self): | ||||||
|         """ |         """ | ||||||
| @@ -93,10 +94,11 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|         """ |         """ | ||||||
|         return (self.handle, self.gramps_id, self.type.serialize(), |         return (self.handle, self.gramps_id, self.type.serialize(), | ||||||
|                 DateBase.serialize(self), |                 DateBase.serialize(self), | ||||||
|                 self.description, self.place, self.cause, |                 self.description, self.place,  | ||||||
|                 SourceBase.serialize(self), |                 SourceBase.serialize(self), | ||||||
|                 NoteBase.serialize(self), |                 NoteBase.serialize(self), | ||||||
|                 MediaBase.serialize(self), |                 MediaBase.serialize(self), | ||||||
|  |                 AttributeBase.serialize(self), | ||||||
|                 self.change, self.marker.serialize(), self.private) |                 self.change, self.marker.serialize(), self.private) | ||||||
|  |  | ||||||
|     def unserialize(self,data): |     def unserialize(self,data): | ||||||
| @@ -109,14 +111,15 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|         @type data: tuple |         @type data: tuple | ||||||
|         """ |         """ | ||||||
|         (self.handle, self.gramps_id, the_type, date, |         (self.handle, self.gramps_id, the_type, date, | ||||||
|          self.description, self.place, self.cause, |          self.description, self.place,  | ||||||
|          source_list, note, media_list, |          source_list, note, media_list, attribute_list, | ||||||
|          self.change, marker, self.private) = data |          self.change, marker, self.private) = data | ||||||
|  |  | ||||||
|         self.marker.unserialize(marker) |         self.marker.unserialize(marker) | ||||||
|         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) | ||||||
|  |         AttributeBase.unserialize(self,attribute_list) | ||||||
|         SourceBase.unserialize(self,source_list) |         SourceBase.unserialize(self,source_list) | ||||||
|         NoteBase.unserialize(self,note)         |         NoteBase.unserialize(self,note)         | ||||||
|  |  | ||||||
| @@ -140,9 +143,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|         @return: Returns the list of all textual attributes of the object. |         @return: Returns the list of all textual attributes of the object. | ||||||
|         @rtype: list |         @rtype: list | ||||||
|         """ |         """ | ||||||
|         return [self.description,str(self.type),self.cause,self.gramps_id] |         return [self.description,str(self.type),self.gramps_id] | ||||||
|         #return [self.description,self.type[1],self.cause, |  | ||||||
|         #        self.get_date(),self.gramps_id] |  | ||||||
|  |  | ||||||
|     def get_text_data_child_list(self): |     def get_text_data_child_list(self): | ||||||
|         """ |         """ | ||||||
| @@ -151,7 +152,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|         @return: Returns the list of child objects that may carry textual data. |         @return: Returns the list of child objects that may carry textual data. | ||||||
|         @rtype: list |         @rtype: list | ||||||
|         """ |         """ | ||||||
|         check_list = self.media_list + self.source_list |         check_list = self.media_list + self.source_list + self.attribute_list | ||||||
|         if self.note: |         if self.note: | ||||||
|             check_list.append(self.note) |             check_list.append(self.note) | ||||||
|         return check_list |         return check_list | ||||||
| @@ -163,7 +164,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|         @return: Returns the list of child secondary child objects that may refer sources. |         @return: Returns the list of child secondary child objects that may refer sources. | ||||||
|         @rtype: list |         @rtype: list | ||||||
|         """ |         """ | ||||||
|         return self.media_list |         return self.media_list + self.attribute_list | ||||||
|  |  | ||||||
|     def get_referenced_handles(self): |     def get_referenced_handles(self): | ||||||
|         """ |         """ | ||||||
| @@ -198,10 +199,9 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|         date = self.get_date_object() |         date = self.get_date_object() | ||||||
|         place = self.get_place_handle() |         place = self.get_place_handle() | ||||||
|         description = self.description |         description = self.description | ||||||
|         cause = self.cause |  | ||||||
|         the_type = self.type |         the_type = self.type | ||||||
|         return (the_type == EventType.CUSTOM and date.is_empty() |         return (the_type == EventType.CUSTOM and date.is_empty() | ||||||
|                 and not place and not description and not cause)  |                 and not place and not description)  | ||||||
|  |  | ||||||
|     def are_equal(self,other): |     def are_equal(self,other): | ||||||
|         """ |         """ | ||||||
| @@ -217,7 +217,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|  |  | ||||||
|         if self.type != other.type or \ |         if self.type != other.type or \ | ||||||
|            ((self.place or other.place) and (self.place != other.place)) or \ |            ((self.place or other.place) and (self.place != other.place)) or \ | ||||||
|            self.description != other.description or self.cause != other.cause \ |            self.description != other.description \ | ||||||
|            or self.private != other.private or \ |            or self.private != other.private or \ | ||||||
|            (not self.get_date_object().is_equal(other.get_date_object())) or \ |            (not self.get_date_object().is_equal(other.get_date_object())) or \ | ||||||
|            len(self.get_source_references()) != len(other.get_source_references()): |            len(self.get_source_references()) != len(other.get_source_references()): | ||||||
| @@ -250,25 +250,6 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): | |||||||
|         """ |         """ | ||||||
|         return self.type |         return self.type | ||||||
|  |  | ||||||
|     def set_cause(self,cause): |  | ||||||
|         """ |  | ||||||
|         Sets the cause of the Event to the passed string. The string |  | ||||||
|         may contain any information. |  | ||||||
|  |  | ||||||
|         @param cause: Cause to assign to the Event |  | ||||||
|         @type cause: str |  | ||||||
|         """ |  | ||||||
|         self.cause = cause |  | ||||||
|  |  | ||||||
|     def get_cause(self): |  | ||||||
|         """ |  | ||||||
|         Returns the cause of the Event. |  | ||||||
|  |  | ||||||
|         @return: Returns the cause of the Event |  | ||||||
|         @rtype: str |  | ||||||
|         """ |  | ||||||
|         return self.cause  |  | ||||||
|  |  | ||||||
|     def set_description(self,description): |     def set_description(self,description): | ||||||
|         """ |         """ | ||||||
|         Sets the description of the Event to the passed string. The string |         Sets the description of the Event to the passed string. The string | ||||||
|   | |||||||
| @@ -32,6 +32,7 @@ Event Reference class for GRAMPS | |||||||
| from _SecondaryObject import SecondaryObject | from _SecondaryObject import SecondaryObject | ||||||
| from _PrivacyBase import PrivacyBase | from _PrivacyBase import PrivacyBase | ||||||
| from _NoteBase import NoteBase | from _NoteBase import NoteBase | ||||||
|  | from _AttributeBase import AttributeBase | ||||||
| from _RefBase import RefBase | from _RefBase import RefBase | ||||||
| from _EventRoleType import EventRoleType | from _EventRoleType import EventRoleType | ||||||
|  |  | ||||||
| @@ -40,7 +41,7 @@ from _EventRoleType import EventRoleType | |||||||
| # Event References for Person/Family | # Event References for Person/Family | ||||||
| # | # | ||||||
| #------------------------------------------------------------------------- | #------------------------------------------------------------------------- | ||||||
| class EventRef(SecondaryObject,PrivacyBase,NoteBase,RefBase): | class EventRef(SecondaryObject,PrivacyBase,NoteBase,AttributeBase,RefBase): | ||||||
|     """ |     """ | ||||||
|     Event reference class. |     Event reference class. | ||||||
|  |  | ||||||
| @@ -55,6 +56,7 @@ class EventRef(SecondaryObject,PrivacyBase,NoteBase,RefBase): | |||||||
|         SecondaryObject.__init__(self) |         SecondaryObject.__init__(self) | ||||||
|         PrivacyBase.__init__(self) |         PrivacyBase.__init__(self) | ||||||
|         NoteBase.__init__(self) |         NoteBase.__init__(self) | ||||||
|  |         AttributeBase.__init__(self) | ||||||
|         RefBase.__init__(self) |         RefBase.__init__(self) | ||||||
|         if source: |         if source: | ||||||
|             self.role = source.role |             self.role = source.role | ||||||
| @@ -65,14 +67,16 @@ class EventRef(SecondaryObject,PrivacyBase,NoteBase,RefBase): | |||||||
|         return ( |         return ( | ||||||
|             PrivacyBase.serialize(self), |             PrivacyBase.serialize(self), | ||||||
|             NoteBase.serialize(self), |             NoteBase.serialize(self), | ||||||
|  |             AttributeBase.serialize(self), | ||||||
|             RefBase.serialize(self), |             RefBase.serialize(self), | ||||||
|             self.role.serialize() |             self.role.serialize() | ||||||
|             ) |             ) | ||||||
|  |  | ||||||
|     def unserialize(self,data): |     def unserialize(self,data): | ||||||
|         (privacy,note,ref,role) = data |         (privacy,note,attribute_list,ref,role) = data | ||||||
|         PrivacyBase.unserialize(self,privacy) |         PrivacyBase.unserialize(self,privacy) | ||||||
|         NoteBase.unserialize(self,note) |         NoteBase.unserialize(self,note) | ||||||
|  |         AttributeBase.unserialize(self,attribute_list) | ||||||
|         RefBase.unserialize(self,ref) |         RefBase.unserialize(self,ref) | ||||||
|         self.role.unserialize(role) |         self.role.unserialize(role) | ||||||
|         return self |         return self | ||||||
| @@ -93,9 +97,19 @@ class EventRef(SecondaryObject,PrivacyBase,NoteBase,RefBase): | |||||||
|         @return: Returns the list of child objects that may carry textual data. |         @return: Returns the list of child objects that may carry textual data. | ||||||
|         @rtype: list |         @rtype: list | ||||||
|         """ |         """ | ||||||
|  |         check_list = self.attribute_list[:] | ||||||
|         if self.note: |         if self.note: | ||||||
|             return [self.note] |             check_list.append(self.note) | ||||||
|         return [] |         return check_list | ||||||
|  |  | ||||||
|  |     def get_sourcref_child_list(self): | ||||||
|  |         """ | ||||||
|  |         Returns the list of child secondary objects that may refer sources. | ||||||
|  |  | ||||||
|  |         @return: Returns the list of child secondary child objects that may refer sources. | ||||||
|  |         @rtype: list | ||||||
|  |         """ | ||||||
|  |         return self.attribute_list[:] | ||||||
|  |  | ||||||
|     def get_referenced_handles(self): |     def get_referenced_handles(self): | ||||||
|         """ |         """ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user