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