-
Notifications
You must be signed in to change notification settings - Fork 6
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
How should the writer=
override work?
#29
Comments
The The default writer callbacks behave as follows:
The last one is meant for Applications dealing with |
Normally you don't call |
Ah, now I think I got you. The reason why passed But just to say it again, the writer should be defined in the widget definition |
Hi @rnixx :-) What would you think of (always used passed-in writer):
|
I'd prefer the following to keep the default writer passing from parent to subsequent widgets sane:
This keeps the following situation sane:
When you call:
|
Hmm. I still don't really like this. This implies:
If possible, I prefer simply: always use Use cases:
The current behaviour basically changes the default for "blank" widgets from root's writer to The only one that I find intuitive is my proposal, the others are surprising: why pass a parameter if it's going to be ignored by widgets that have their own opinion? In this case, if you actually want your specified Sorry for belabouring this. |
Ah, of course, duh :-)
|
I assumed that the passed-in writer is an override, but evidently it's meant more as a fallback. |
@jean Your objections are valid and I'm happy that you point it out. Things can only get better if they are discussed ;) Actually In common forms it's normally totally adequate to just define the A case where it might be worth for a custom writer somewhere in the tree is if some data should not end up on the given model, or additionally should end up elsewhere. Such writers might be defined on compounds but I do not want to affect the default persisting behaviour on the compound children in such a case. Obviously this causes confusions. I don't want to immediately change the behaviour but instead let your input settle a little bit. Maybe @jensens has some more input to this subject. I am not totally against changing the behaviour, but if we do we should do it right once If we decide to keep the current behaviour we should think about a proper argument naming and provide a clear documentation which is missing in this case without question. |
I wanted to add the following test:
But this fails:
If I understand correctly, it works like this:
self.persist_writer
, that is used throughout.writer=
is passed, that is used for child nodes that don't haveself.persist_writer
set.writer=
is not used for nodes that already haveself.persist_writer
set.That seems surprising. I would expect
writer=
to always govern if it's passed. So I think I'm probably misunderstanding. If you have some time, could you let me know if I am?The text was updated successfully, but these errors were encountered: