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

# Class StorageByKeyName

source code

    Store and retrieve a credential to and from the App Engine datastore.

    This Storage helper presumes the Credentials have been stored as a
    CredentialsProperty or CredentialsNDBProperty on a datastore model class, and
    that entities are stored by key_name.

Instance Methods | [hide private]
__init__(self, model, key_name, property_name, cache=None, user=None) Constructor for Storage. | source code
_is_ndb(self) Determine whether the model of the instance is an NDB model. | source code
_get_entity(self) Retrieve entity from datastore. | source code
_delete_entity(self) Delete entity from datastore. | source code
locked_get(self) Retrieve Credential from datastore. | source code
locked_put(self, credentials) Write a Credentials to the datastore. | source code
locked_delete(self) Delete Credential from datastore. | source code
Inherited from `client.Storage`: `acquire_lock`, `delete`, `get`, `put`, `release_lock` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, model, key_name, property_name, cache=None, user=None) (Constructor) | source code
    Constructor for Storage.

    Args:
      model: db.Model or ndb.Model, model class
      key_name: string, key name for the entity that has the credentials
      property_name: string, name of the property that is a CredentialsProperty
        or CredentialsNDBProperty.
      cache: memcache, a write-through cache to put in front of the datastore.
        If the model you are using is an NDB model, using a cache will be
        redundant since the model uses an instance cache and memcache for you.
      user: users.User object, optional. Can be used to grab user ID as a
        key_name if no key name is specified.
Decorators: `@util.positional(4)` Overrides: object.__init__

### _is_ndb(self) | source code
    Determine whether the model of the instance is an NDB model.

    Returns:
      Boolean indicating whether or not the model is an NDB or DB model.

### _get_entity(self) | source code
    Retrieve entity from datastore.

    Uses a different model method for db or ndb models.

    Returns:
      Instance of the model corresponding to the current storage object
          and stored using the key name of the storage object.

### _delete_entity(self) | source code
    Delete entity from datastore.

    Attempts to delete using the key_name stored on the object, whether or not
    the given key is in the datastore.

### locked_get(self) | source code
    Retrieve Credential from datastore.

    Returns:
      oauth2client.Credentials
Overrides: client.Storage.locked_get

### locked_put(self, credentials) | source code
    Write a Credentials to the datastore.

    Args:
      credentials: Credentials, the credentials to store.
Overrides: client.Storage.locked_put

### locked_delete(self) | source code
    Delete Credential from datastore.
Overrides: client.Storage.locked_delete