-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Sometimes in projects we use models with __init__
method. something like this:
class Cube(Model):
x = Column()
y = Column()
z = Column()
def __init__():
self.x = 10
self.y = 10
However, a resource with a post method will not work with this model. The create_object
method throws a TypeError. This is due to such initialization of the model in this method:
obj = self.model(**{key: value
for (key, value) in data.items() if key not in join_fields})
That is, there is no validation of the arguments of the __init__
method.
I suggest using inspect.getfullargspec
to determine that a model can only accept a limited list of arguments.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working