INNER CODE UNIT · Python

BaseSchema

Scille/umongo · src/umongo/abstract.py:27

class BaseSchema(ma.Schema):
    """All schema used in umongo should inherit from this base schema"""

    # This class attribute is overriden by the builder upon registration
    # to let the template set the base marshmallow schema class.
    # It may be overriden in Template classes.
    MA_BASE_SCHEMA_CLS = BaseMarshmallowSchema

    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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…