Exemplo n.º 1
0
    def to_python(self, value):
        if value is not None and isinstance(value, six.string_types):
            value = decrypt(value)

        # The following below is a copypaste of PickledObjectField.to_python of
        # v1.0.0 with one change: We re-raise any baseexceptions such as
        # signals. 1.0.0 has a bare `except:` which causes issues.

        if value is not None:
            try:
                value = dbsafe_decode(value, self.compress)
            except Exception:
                # If the value is a definite pickle; and an error is raised in
                # de-pickling it should be allowed to propagate.
                if isinstance(value, PickledObject):
                    raise
            else:
                if isinstance(value, _ObjectWrapper):
                    return value._obj

        return value
Exemplo n.º 2
0
 def to_python(self, value):
     if value is not None and isinstance(value, six.string_types):
         value = decrypt(value)
     return super(EncryptedTextField, self).to_python(value)
Exemplo n.º 3
0
 def to_python(self, value):
     if value is not None and isinstance(value, six.string_types):
         value = decrypt(value)
     return super(EncryptedTextField, self).to_python(value)
Exemplo n.º 4
0
 def to_python(self, value):
     if value is not None and isinstance(value, str):
         value = decrypt(value)
     return super().to_python(value)