emmett-framework / emmett

The web framework for inventors
BSD 3-Clause "New" or "Revised" License
1.08k stars 72 forks source link

Bug with Custom Serializer (version 2.4.5) #429

Closed josejachuf closed 2 years ago

josejachuf commented 2 years ago

A situation similar to [1], regarding the versions

In Emmett-Rest I have a Custom Serializer similar to the following

A note that I did not initially, myfield is a belongs_to

class MySerializer(Serializer):

    def myfield_name(self, row):
        if row.myfield:
            return row.myfield.name
        return ''

When I make a post row.myfield is considered an integer

return row.myfield.name AttributeError: 'int' object has no attribute 'name'

In cases when I do get works fine

This fails with these versions:

emmett 2.4.5 emmett-rest 1.4

and works fine whit:

emmett 2.3.1 emmett-rest 1.2.0

[1] https://github.com/emmett-framework/emmett/issues/428

josejachuf commented 2 years ago

Error also with

emmett 2.4.5 emmett 2.3.1

gi0baro commented 2 years ago

@josejachuf this is confirmed, gonna work out a fix for a 2.4.6

josejachuf commented 2 years ago

Thanks

gi0baro commented 2 years ago

@josejachuf should have been fixed with current master. Gonna release 2.4.6 later today/tomorrow