INNER CODE UNIT · Python
__init__
Scille/umongo · src/umongo/abstract.py:35
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.error_messages = I18nErrorDict(self.error_messages)
self._ma_schema = None
def map_to_field(self, func):
"""Apply a function to every field in the schema
>>> def func(mongo_path, path, field):
... pass
"""
for name, field in self.fields.items():
mongo_path = field.attribute or name
func(mongo_path, name, field)
if hasattr(field, "map_to_field"):
field.map_to_field(mongo_path, name, func)
def as_marshmallow_schema(self):