示例#1
0
文件: Fields.py 项目: utsdab/usr
    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)
示例#2
0
文件: Fields.py 项目: utsdab/usr
    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)
示例#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)
示例#4
0
文件: Fields.py 项目: utsdab/usr
    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)
示例#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)
示例#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)
示例#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)
示例#8
0
文件: Fields.py 项目: utsdab/usr
 def pack(self, obj):
     """Pack the fieldname of the object we are dealing with."""
     packed = obj.__class__.__name__
     return string_literal(packed)
示例#9
0
文件: Fields.py 项目: utsdab/usr
 def pack(self, data):
     """Pack the data as serialized json."""
     if not data:
         return "NULL"
     packed = json.dumps(data)
     return string_literal(packed)
示例#10
0
 def pack(self, obj):
     """Pack the fieldname of the object we are dealing with."""
     packed = obj.__class__.__name__
     return string_literal(packed)
示例#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)