当前位置: 首页>>代码示例>>Python>>正文


Python marshmallow.post_load方法代码示例

本文整理汇总了Python中marshmallow.post_load方法的典型用法代码示例。如果您正苦于以下问题:Python marshmallow.post_load方法的具体用法?Python marshmallow.post_load怎么用?Python marshmallow.post_load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在marshmallow的用法示例。


在下文中一共展示了marshmallow.post_load方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _pagination_parameters_schema_factory

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def _pagination_parameters_schema_factory(
        def_page, def_page_size, def_max_page_size):
    """Generate a PaginationParametersSchema"""

    class PaginationParametersSchema(ma.Schema):
        """Deserializes pagination params into PaginationParameters"""

        class Meta:
            ordered = True
            if MARSHMALLOW_VERSION_MAJOR < 3:
                strict = True
            else:
                unknown = ma.EXCLUDE

        page = ma.fields.Integer(
            missing=def_page,
            validate=ma.validate.Range(min=1)
        )
        page_size = ma.fields.Integer(
            missing=def_page_size,
            validate=ma.validate.Range(min=1, max=def_max_page_size)
        )

        @ma.post_load
        def make_paginator(self, data, **kwargs):
            return PaginationParameters(**data)

    return PaginationParametersSchema 
开发者ID:marshmallow-code,项目名称:flask-smorest,代码行数:30,代码来源:pagination.py

示例2: post_load

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def post_load(self, data, **kwargs):
        return Link(**data) 
开发者ID:paperswithcode,项目名称:sota-extractor,代码行数:4,代码来源:schemas.py

示例3: _load

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def _load(self, data):
        return self.post_load(data) 
开发者ID:quantmind,项目名称:lux,代码行数:4,代码来源:schema.py

示例4: post_load

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def post_load(self, data):
        return data 
开发者ID:quantmind,项目名称:lux,代码行数:4,代码来源:schema.py

示例5: post_load

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def post_load(self, data):
        data["plugin"] = resolve_plugin_slug(data["slug"])
        data["options"] = data["plugin"].validate_options(data["options"])
        return data 
开发者ID:Netflix-Skunkworks,项目名称:diffy,代码行数:6,代码来源:schema.py

示例6: __init__

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def __init__(self):
        self.Serializer = flask_ma.Schema
        self.ModelSerializer = ModelSerializer

        # alias marshmallow stuffs
        self.pre_load = ma.pre_load
        self.post_load = ma.post_load
        self.pre_dump = ma.pre_dump
        self.post_dump = ma.post_dump
        self.validates = ma.validates
        self.validates_schema = ma.validates_schema
        self.ValidationError = ma.ValidationError

        # alias marshmallow fields
        self.Bool = ma.fields.Bool
        self.Boolean = ma.fields.Boolean
        self.Constant = ma.fields.Constant
        self.Date = ma.fields.Date
        self.DateTime = ma.fields.DateTime
        self.NaiveDateTime = ma.fields.NaiveDateTime
        self.AwareDateTime = ma.fields.AwareDateTime
        self.Decimal = ma.fields.Decimal
        self.Dict = ma.fields.Dict
        self.Email = ma.fields.Email
        self.Field = ma.fields.Field
        self.Float = ma.fields.Float
        self.Function = ma.fields.Function
        self.Int = ma.fields.Int
        self.Integer = ma.fields.Integer
        self.List = ma.fields.List
        self.Mapping = ma.fields.Mapping
        self.Method = ma.fields.Method
        self.Nested = ma.fields.Nested
        self.Number = ma.fields.Number
        self.Pluck = ma.fields.Pluck
        self.Raw = ma.fields.Raw
        self.Str = ma.fields.Str
        self.String = ma.fields.String
        self.Time = ma.fields.Time
        self.TimeDelta = ma.fields.TimeDelta
        self.Tuple = ma.fields.Tuple
        self.UUID = ma.fields.UUID
        self.Url = ma.fields.Url
        self.URL = ma.fields.URL

        # alias flask_marshmallow fields
        self.AbsoluteUrlFor = flask_ma.fields.AbsoluteUrlFor
        self.AbsoluteURLFor = flask_ma.fields.AbsoluteURLFor
        self.UrlFor = flask_ma.fields.UrlFor
        self.URLFor = flask_ma.fields.URLFor
        self.Hyperlinks = flask_ma.fields.Hyperlinks
        self.HyperlinkRelated = HyperlinkRelated 
开发者ID:briancappello,项目名称:flask-unchained,代码行数:54,代码来源:marshmallow.py


注:本文中的marshmallow.post_load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。