Configuration#
- oblate.config#
The global configuration of Oblate.
This is an instance of
GlobalConfigwhich can be modified to edit the global configuration. For information on available attributes, see the documentation ofGlobalConfig.- Type:
- Value:
oblate.GlobalConfig
- class oblate.GlobalConfig(*, warn_unsupported_types=True, validation_error_cls=<class 'oblate.exceptions.ValidationError'>)#
The global configuration of Oblate.
Global configuration applies to globally to each defined schema instead of being per-schema. The instance of this class is availabe as
oblate.config. The attributes of this class are available config options that can be customized.For more information on working with configurations, see user guide Configuration.
- validation_error_cls#
The
ValidationErrorexception class which will be raised on validation failure.- Type:
Type[
ValidationError]
- warn_unsupported_types#
Whether to warn about usage of unsupported types in type validation.
This dictates whether to issue a warning if a type is used in a type expression in fields involving type validation that cannot be validated by Oblate.
New in version 1.1.
- Type:
bool
- class oblate.SchemaConfig#
The configuration for a schema.
This is a base class for defining configuration of a schema. In order to define configuration for a schema, this class is subclassed inside a
Schema:class User(oblate.Schema): id = fields.Integer() class Config(oblate.SchemaConfig): ... # override config options
- add_repr = True#
Whether to add a
__repr__()for detailing schema fields when printed.
- slotted = True#
Whether to add a
__slots__to the schema class.This could improve the performance but also limits the ability to set any extra attributes on the schema. This is ignored when the schema has already defined
__slots__.
- ignore_extra = False#
Whether to ignore extra (invalid) field names when initializing schema.
This configuration can be overriden per initialization/update using the
ignore_extraparameter inSchemainitialization.
- frozen = False#
Whether the schema is read only.
When set to True, the schema cannot be updated once initialized. Defaults to False.