示例#1
0
 def unserialize(self, data):
     """
     Converts a serialized tuple of data to an object
     """
     if data == None:
         self.date = Date()
     else:
         self.date = Date().unserialize(data)
示例#2
0
 def unserialize(self, data):
     """
     Converts a serialized tuple of data to an object
     """
     if data == None:
         self.date = Date()
     else:
         self.date = Date().unserialize(data)
示例#3
0
    def get_date_object(self):
        """
        Returns the L{Date} object associated with the DateBase.

        @return: Returns a DateBase L{Date} instance.
        @rtype: L{Date}
        """
        if not self.date:
            self.date = Date()
        return self.date
示例#4
0
class DateBase:
    """
    Base class for storing date information.
    """

    def __init__(self, source=None):
        """
        Create a new DateBase, copying from source if not None
        
        @param source: Object used to initialize the new object
        @type source: DateBase
        """
        if source:
            self.date = Date(source.date)
        else:
            self.date = Date()

    def serialize(self, no_text_date=False):
        """
        Converts the object to a serialized tuple of data
        """
        if self.date == None or (self.date.is_empty() and not self.date.text):
            date = None
        else:
            date = self.date.serialize(no_text_date)
        return date

    def unserialize(self, data):
        """
        Converts a serialized tuple of data to an object
        """
        if data == None:
            self.date = Date()
        else:
            self.date = Date().unserialize(data)

    def get_date_object(self):
        """
        Returns the L{Date} object associated with the DateBase.

        @return: Returns a DateBase L{Date} instance.
        @rtype: L{Date}
        """
        if not self.date:
            self.date = Date()
        return self.date

    def set_date_object(self, date):
        """
        Sets the L{Date} object associated with the DateBase.

        @param date: L{Date} instance to be assigned to the DateBase
        @type date: L{Date}
        """
        self.date = date
示例#5
0
class DateBase:
    """
    Base class for storing date information.
    """

    def __init__(self, source=None):
        """
        Create a new DateBase, copying from source if not None
        
        @param source: Object used to initialize the new object
        @type source: DateBase
        """
        if source:
            self.date = Date(source.date)
        else:
            self.date = Date()

    def serialize(self, no_text_date=False):
        """
        Converts the object to a serialized tuple of data
        """
        if self.date == None or (self.date.is_empty() and not self.date.text):
            date = None
        else:
            date = self.date.serialize(no_text_date)
        return date

    def unserialize(self, data):
        """
        Converts a serialized tuple of data to an object
        """
        if data == None:
            self.date = Date()
        else:
            self.date = Date().unserialize(data)

    def get_date_object(self):
        """
        Returns the L{Date} object associated with the DateBase.

        @return: Returns a DateBase L{Date} instance.
        @rtype: L{Date}
        """
        if not self.date:
            self.date = Date()
        return self.date

    def set_date_object(self, date):
        """
        Sets the L{Date} object associated with the DateBase.

        @param date: L{Date} instance to be assigned to the DateBase
        @type date: L{Date}
        """
        self.date = date
示例#6
0
 def __init__(self, source=None):
     """
     Create a new DateBase, copying from source if not None
     
     @param source: Object used to initialize the new object
     @type source: DateBase
     """
     if source:
         self.date = Date(source.date)
     else:
         self.date = Date()
示例#7
0
 def __init__(self, source=None):
     """
     Create a new DateBase, copying from source if not None
     
     @param source: Object used to initialize the new object
     @type source: DateBase
     """
     if source:
         self.date = Date(source.date)
     else:
         self.date = Date()
示例#8
0
    def get_date_object(self):
        """
        Returns the L{Date} object associated with the DateBase.

        @return: Returns a DateBase L{Date} instance.
        @rtype: L{Date}
        """
        if not self.date:
            self.date = Date()
        return self.date