Esempio n. 1
0
File: Fields.py Progetto: 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)
Esempio n. 2
0
File: Fields.py Progetto: 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)
Esempio n. 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)
Esempio n. 4
0
File: Fields.py Progetto: 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 8
0
File: Fields.py Progetto: utsdab/usr
 def pack(self, obj):
     """Pack the fieldname of the object we are dealing with."""
     packed = obj.__class__.__name__
     return string_literal(packed)
Esempio n. 9
0
File: Fields.py Progetto: 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)
Esempio n. 10
0
 def pack(self, obj):
     """Pack the fieldname of the object we are dealing with."""
     packed = obj.__class__.__name__
     return string_literal(packed)
Esempio n. 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)