Package oauth2client :: Module appengine :: Class CredentialsNDBProperty |
[hide private]
[frames] | no frames]

# Class CredentialsNDBProperty

source code

    App Engine NDB datastore Property for Credentials.

    Serves the same purpose as the DB CredentialsProperty, but for NDB models.
    Since CredentialsProperty stores data as a blob and this inherits from
    BlobProperty, the data in the datastore will be the same as in the DB case.

    Utility property that allows easy storage and retrieval of Credentials and
    subclasses.

Instance Methods | [hide private]
_validate(self, value) Validates a value as a proper credentials object. | source code
_to_base_type(self, value) Converts our validated value to a JSON serialized string. | source code
_from_base_type(self, value) Converts our stored JSON string back to the desired type. | source code

Method Details | [hide private]

### _validate(self, value) | source code
    Validates a value as a proper credentials object.

    Args:
      value: A value to be set on the property.

    Raises:
      TypeError if the value is not an instance of Credentials.

### _to_base_type(self, value) | source code
    Converts our validated value to a JSON serialized string.

    Args:
      value: A value to be set in the datastore.

    Returns:
      A JSON serialized version of the credential, else '' if value is None.

### _from_base_type(self, value) | source code
    Converts our stored JSON string back to the desired type.

    Args:
      value: A value from the datastore to be converted to the desired type.

    Returns:
      A deserialized Credentials (or subclass) object, else None if the
          value can't be parsed.