Example #1
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in a Family structure.
        """
        (self.handle, self.gramps_id, self.father_handle, self.mother_handle,
         child_ref_list, the_type, event_ref_list, media_list, attribute_list,
         lds_seal_list, citation_list, note_list, self.change, tag_list,
         self.private) = data

        self.type = FamilyRelType()
        self.type.unserialize(the_type)
        self.event_ref_list = [
            EventRef().unserialize(er) for er in event_ref_list
        ]
        self.child_ref_list = [
            ChildRef().unserialize(cr) for cr in child_ref_list
        ]
        MediaBase.unserialize(self, media_list)
        AttributeBase.unserialize(self, attribute_list)
        CitationBase.unserialize(self, citation_list)
        NoteBase.unserialize(self, note_list)
        LdsOrdBase.unserialize(self, lds_seal_list)
        TagBase.unserialize(self, tag_list)
        return self
Example #2
0
 def __init__(self):
     """Create a new Citation instance."""
     PrimaryObject.__init__(self)
     MediaBase.__init__(self)  #  7
     NoteBase.__init__(self)  #  6
     DateBase.__init__(self)  #  2
     self.source_handle = None  #  5
     self.page = ""  #  3
     self.confidence = Citation.CONF_NORMAL  #  4
     self.datamap = {}  #  8
Example #3
0
 def __init__(self):
     """Create a new Source instance."""
     PrimaryObject.__init__(self)
     MediaBase.__init__(self)
     NoteBase.__init__(self)
     self.title = ""
     self.author = ""
     self.pubinfo = ""
     self.datamap = {}
     self.abbrev = ""
     self.reporef_list = []
Example #4
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in an Event structure.
        """
        (self.handle, self.gramps_id, self.title, self.author, self.pubinfo,
         note_list, media_list, self.abbrev, self.change, self.datamap,
         reporef_list, self.private) = data

        NoteBase.unserialize(self, note_list)
        MediaBase.unserialize(self, media_list)
        self.reporef_list = [
            RepoRef().unserialize(item) for item in reporef_list
        ]
        return self
Example #5
0
    def serialize(self):
        """
        Convert the data held in the Place to a Python tuple that
        represents all the data elements. 
        
        This method is used to convert the object into a form that can easily 
        be saved to a database.

        These elements may be primitive Python types (string, integers),
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objects or
        lists), the database is responsible for converting the data into
        a form that it can use.

        :returns: Returns a python tuple containing the data that should
            be considered persistent.
        :rtype: tuple
        """

        if self.main_loc is None or self.main_loc.serialize() == _EMPTY_LOC:
            main_loc = None
        else:
            main_loc = self.main_loc.serialize()

        return (self.handle, self.gramps_id, self.title, self.long, self.lat,
                main_loc, [al.serialize()
                           for al in self.alt_loc], UrlBase.serialize(self),
                MediaBase.serialize(self), CitationBase.serialize(self),
                NoteBase.serialize(self), self.change, self.private)
Example #6
0
    def serialize(self):
        """
        Convert the data held in the event to a Python tuple that
        represents all the data elements. 
        
        This method is used to convert the object into a form that can easily 
        be saved to a database.

        These elements may be primitive Python types (string, integers),
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objects or
        lists), the database is responsible for converting the data into
        a form that it can use.

        :returns: Returns a python tuple containing the data that should
            be considered persistent.
        :rtype: tuple
        """
        return (self.handle, self.gramps_id, self.father_handle,
                self.mother_handle,
                [cr.serialize()
                 for cr in self.child_ref_list], self.type.serialize(),
                [er.serialize()
                 for er in self.event_ref_list], MediaBase.serialize(self),
                AttributeBase.serialize(self), LdsOrdBase.serialize(self),
                CitationBase.serialize(self), NoteBase.serialize(self),
                self.change, TagBase.serialize(self), self.private)
Example #7
0
 def serialize(self):
     """
     Convert the object to a serialized tuple of data.
     """
     return (self.handle, self.gramps_id, unicode(self.title),
             unicode(self.author), unicode(self.pubinfo),
             NoteBase.serialize(self), MediaBase.serialize(self),
             unicode(self.abbrev), self.change, self.datamap,
             [rr.serialize() for rr in self.reporef_list], self.private)
Example #8
0
 def __init__(self):
     """
     Create a new Family instance. 
     
     After initialization, most data items have empty or null values, 
     including the database handle.
     """
     PrimaryObject.__init__(self)
     CitationBase.__init__(self)
     NoteBase.__init__(self)
     MediaBase.__init__(self)
     AttributeBase.__init__(self)
     LdsOrdBase.__init__(self)
     TagBase.__init__(self)
     self.father_handle = None
     self.mother_handle = None
     self.child_ref_list = []
     self.type = FamilyRelType()
     self.event_ref_list = []
     self.complete = 0
Example #9
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in an Event structure.

        :param data: tuple containing the persistent data associated the
            Person object
        :type data: tuple
        """
        (self.handle, self.gramps_id, the_type, date, self.__description,
         self.place, citation_list, note_list, media_list, attribute_list,
         self.change, self.private) = data

        self.__type = EventType()
        self.__type.unserialize(the_type)
        DateBase.unserialize(self, date)
        MediaBase.unserialize(self, media_list)
        AttributeBase.unserialize(self, attribute_list)
        CitationBase.unserialize(self, citation_list)
        NoteBase.unserialize(self, note_list)
        return self
Example #10
0
    def __init__(self, source=None):
        """
        Create a new Event instance, copying from the source if present.

        :param source: An event used to initialize the new event
        :type source: Event
        """

        PrimaryObject.__init__(self, source)
        CitationBase.__init__(self, source)
        NoteBase.__init__(self, source)
        MediaBase.__init__(self, source)
        AttributeBase.__init__(self)
        DateBase.__init__(self, source)
        PlaceBase.__init__(self, source)

        if source:
            self.__description = source.__description
            self.__type = EventType(source.__type)
        else:
            self.__description = ""
            self.__type = EventType()
Example #11
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in a Citation structure.
        """
        (
            self.handle,  #  0
            self.gramps_id,  #  1
            date,  #  2
            self.page,  #  3
            self.confidence,  #  4
            self.source_handle,  #  5
            note_list,  #  6
            media_list,  #  7
            self.datamap,  #  8
            self.change,  #  9
            self.private  # 10
        ) = data

        DateBase.unserialize(self, date)
        NoteBase.unserialize(self, note_list)
        MediaBase.unserialize(self, media_list)
        return self
Example #12
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in a Place object.

        :param data: tuple containing the persistent data associated the
            Person object
        :type data: tuple
        """
        (self.handle, self.gramps_id, self.title, self.long, self.lat,
         main_loc, alt_loc, urls, media_list, citation_list, note_list,
         self.change, self.private) = data

        if main_loc is None:
            self.main_loc = None
        else:
            self.main_loc = Location().unserialize(main_loc)
        self.alt_loc = [Location().unserialize(al) for al in alt_loc]
        UrlBase.unserialize(self, urls)
        MediaBase.unserialize(self, media_list)
        CitationBase.unserialize(self, citation_list)
        NoteBase.unserialize(self, note_list)
        return self
Example #13
0
    def __init__(self, source=None):
        """
        Create a new Place object, copying from the source if present.

        :param source: A Place object used to initialize the new Place
        :type source: Place
        """
        PrimaryObject.__init__(self, source)
        CitationBase.__init__(self, source)
        NoteBase.__init__(self, source)
        MediaBase.__init__(self, source)
        UrlBase.__init__(self, source)
        if source:
            self.long = source.long
            self.lat = source.lat
            self.title = source.title
            self.main_loc = Location(source.main_loc)
            self.alt_loc = map(Location, source.alt_loc)
        else:
            self.long = ""
            self.lat = ""
            self.title = ""
            self.main_loc = None
            self.alt_loc = []
Example #14
0
 def serialize(self, no_text_date=False):
     """
     Convert the object to a serialized tuple of data.
     """
     return (
         self.handle,  #  0
         self.gramps_id,  #  1
         DateBase.serialize(self, no_text_date),  #  2
         unicode(self.page),  #  3
         self.confidence,  #  4
         self.source_handle,  #  5
         NoteBase.serialize(self),  #  6
         MediaBase.serialize(self),  #  7
         self.datamap,  #  8
         self.change,  #  9
         self.private)  # 10
Example #15
0
    def serialize(self, no_text_date=False):
        """
        Convert the data held in the event to a Python tuple that
        represents all the data elements. 
        
        This method is used to convert the object into a form that can easily 
        be saved to a database.

        These elements may be primitive Python types (string, integers),
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objects or
        lists), the database is responsible for converting the data into
        a form that it can use.

        :returns: Returns a python tuple containing the data that should
            be considered persistent.
        :rtype: tuple
        """
        return (self.handle, self.gramps_id, self.__type.serialize(),
                DateBase.serialize(self, no_text_date), self.__description,
                self.place, CitationBase.serialize(self),
                NoteBase.serialize(self), MediaBase.serialize(self),
                AttributeBase.serialize(self), self.change, self.private)