marshmallow-code / marshmallow-code/flask-marshmallow

The function decorated by the "post_load" decorator will undergo changes in parameter types as the function name changes.

Open
#276 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
887
Forks
65
Avg merge
7h 25m
Merged PRs (30d)
3

Description

`
class AdGroupUpsertSchemaV3(ma.SQLAlchemySchema):
name = fields.String(required=True)

class Meta:
model = models.AdGroup
fields = 'name'
load_instance = True

@post_load
def a(self, data, *args, **kwargs):
print(type(data))
return data
`

flask-marshmallow==0.14.0
marshmallow==3.17.0
marshmallow-sqlalchemy==0.28.1

like the code above,when post_load decorator func name is a-m, data type is dict, when func name is n-z, data type is

why why why?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload names no repository file or test. Reproduce the snippet with flask-marshmallow 0.14.0, marshmallow 3.17.0, and marshmallow-sqlalchemy 0.28.1, then trace post_load handling alongside SQLAlchemySchema and load_instance. A useful resolution would explain why renaming the method changes data's type and add a regression test if the behavior is unintended.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python, sqlalchemy
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.