New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve signatures to pre/post_* decorators #276

Closed
sloria opened this Issue Sep 14, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@sloria
Member

sloria commented Sep 14, 2015

Copied from #153 (comment):

There are a few improvements to the pre/post_* and validates* decorators I'd like to make before the 2.0.0 final release.

Problems:

  • As pointed out in #216, there is no way to get access to the target object (the data to be (de)serialized). This is possible, however, with validates_schema via the pass_original param.
  • Also related to #216: The "raw" param is misleading. Users might think that it means that the raw target object is passed, but it does not.

Proposal:

  • Rename raw -> pass_many.
  • Add pass_original to post_dump and post_load. Maybe rename to pass_target or pass_input--not sure about this.

Update: pass_original only makes sense for post_dump and post_load.

@sloria sloria modified the milestone: 2.0.0rc2 Sep 16, 2015

sloria added a commit that referenced this issue Sep 16, 2015

Add pass_original param to post_load and post_dump
ref #276

IMPORTANT: This effectively drops support for pre/post_*
staticmethods and classmethods because the pass_original relies
on the setting of the __marshmallow_kwargs__ attribute set on
the methods, which doesn't seem to be working static and class
methods. We may revisit this in the future, but for the time
being, processors must be instance methods.

@sloria sloria referenced this issue Sep 16, 2015

Merged

Improve decorator signatures #278

4 of 4 tasks complete
@sloria

This comment has been minimized.

Member

sloria commented Sep 16, 2015

Done in 1463a61

@sloria sloria closed this Sep 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment