本文整理汇总了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
示例2: post_load
# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def post_load(self, data, **kwargs):
return Link(**data)
示例3: _load
# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def _load(self, data):
return self.post_load(data)
示例4: post_load
# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_load [as 别名]
def post_load(self, data):
return data
示例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
示例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