Beispiel #1
0
    def pack(self, data):
        """Pack the data by joining all the fields with our separator."""
        if not data:
            return "NULL"

        packed = self.separator.join([str(item) for item in data])
        return string_literal(packed)
Beispiel #2
0
    def pack(self, data):
        """Pack the data by running cPickle.dumps() on the dictionary."""
        if not data:
            return "NULL"

        packed = cPickle.dumps(data)
        return string_literal(packed)
Beispiel #3
0
    def pack(self, data):
        """Pack the data by running cPickle.dumps() on the dictionary."""
        if not data:
            return 'NULL'

        packed = cPickle.dumps(data)
        return string_literal(packed)
Beispiel #4
0
    def pack(self, data):
        """Pack the data for this field to be saved in the database.  By
        default the value is cast to a string.

        @param data: the data that needs to be packed
        @type data: varying

        @return: a packed representation of the passed in data that can
          be saved to the database
        @rtype: varying
        """
        if data is None:
            if self.default is None:
                return "NULL"
            return string_literal("")
        return string_literal(data)
Beispiel #5
0
    def pack(self, data):
        """Pack the data by joining all the fields with our separator."""
        if not data:
            return 'NULL'

        packed = self.separator.join([str(item) for item in data])
        return string_literal(packed)
Beispiel #6
0
    def pack(self, data):
        """Pack the data by joining all the fields with our separator."""
        if not data:
            return 'NULL'

        packed = self.separator.join(data)
        return string_literal(packed)
Beispiel #7
0
    def pack(self, data):
        """Pack the data for this field to be saved in the database.  By
        default the value is cast to a string.

        @param data: the data that needs to be packed
        @type data: varying

        @return: a packed representation of the passed in data that can
          be saved to the database
        @rtype: varying
        """
        if data is None:
            if self.default is None:
                return 'NULL'
            return string_literal('')
        return string_literal(data)
Beispiel #8
0
 def pack(self, obj):
     """Pack the fieldname of the object we are dealing with."""
     packed = obj.__class__.__name__
     return string_literal(packed)
Beispiel #9
0
 def pack(self, data):
     """Pack the data as serialized json."""
     if not data:
         return "NULL"
     packed = json.dumps(data)
     return string_literal(packed)
Beispiel #10
0
 def pack(self, obj):
     """Pack the fieldname of the object we are dealing with."""
     packed = obj.__class__.__name__
     return string_literal(packed)
Beispiel #11
0
 def pack(self, data):
     """Pack the data as serialized json."""
     if not data:
         return 'NULL'
     packed = json.dumps(data)
     return string_literal(packed)