We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I would like the __init__ and populate methods ref, to have the following signature:
__init__
populate
def __init__(self, throw_on_unknown_keyword = False, **kwargs): # ... def populate(self, throw_on_unknown_keyword = False, **values): # ... if structure_name in values: field.__set__(self, values.pop(structure_name)) elif throw_on_unknown_keyword and structure_name != 'throw_on_unknown_keyword' : throw # ... for name, _, field in fields: if name in values: field.__set__(self, values.pop(name)) elif throw_on_unknown_keyword and name != 'throw_on_unknown_keyword': throw # ... # warning: I have not checked the details!
Reason: I wrap the Model inside a class:
class A: class ModelA(models.Base): a = fields.DateTimeField(required=True) b = fields.FloatField(required=True) c = fields.FloatField(required=True) def __init__(self, **kwargs): self.model = self.ModelA(throw_on_unknown_keyword = True, **kwargs) # #Instead of #def __init__(self, a, b, c): # self.model = self.ModelA(a = a, b = b, c = c)
With throw_on_unknown_keyword = True, I keep the constructor of A and the model synchronized, and get an exception if they are not synchronized.
throw_on_unknown_keyword = True
Is that feasible?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I would like the
__init__
andpopulate
methods ref, to have the following signature:Reason: I wrap the Model inside a class:
With
throw_on_unknown_keyword = True
, I keep the constructor of A and the model synchronized, and get an exception if they are not synchronized.Is that feasible?
The text was updated successfully, but these errors were encountered: