View source on GitHub |
A base class for a configuration object.
Inherits From: expected_type
google.appengine.datastore.datastore_rpc.BaseConfiguration(
config=None, **kwargs
)
Subclasses should provide validation functions for every configuration option they accept. Any public function decorated with ConfigOption is assumed to be a validation function for an option of the same name. All validation functions take a single non-None value to validate and must throw an exception or return the value to store.
This class forces subclasses to be immutable and exposes a read-only property for every accepted configuration option. Configuration options set by passing keyword arguments to the constructor. The constructor and merge function are designed to avoid creating redundant copies and may return the configuration objects passed to them if appropriate.
Setting an option to None is the same as not specifying the option except in the case where the 'config' argument is given. In this case the value on 'config' of the same name is ignored. Options that are not specified will return 'None' when accessed.
Args | |
---|---|
config
|
Optional base configuration providing default values for parameters not specified in the keyword arguments. |
**kwargs
|
Configuration options to store on this object. |
Methods
is_configuration
@classmethod
is_configuration( obj )
True if configuration obj handles all options of this class.
Use this method rather than isinstance(obj, cls) to test if a configuration object handles the options of cls (is_configuration is handled specially for results of merge which may handle the options of unrelated configuration classes).
Args | |
---|---|
obj
|
the object to test. |
merge
merge(
config
)
Merge two configurations.
The configuration given as an argument (if any) takes priority; defaults are filled in from the current configuration.
Args | |
---|---|
config
|
Configuration providing overrides, or None (but cannot be omitted). |
Returns | |
---|---|
Either a new configuration object or (if it would be equivalent) self or the config argument unchanged, but never None. |
Raises | |
---|---|
BadArgumentError if self or config are of configurations classes with conflicting options (i.e. the same option name defined in two different configuration classes). |
__eq__
__eq__(
other
)
Return self==value.
__ne__
__ne__(
other
)
Return self!=value.