Skip to content
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

Should WidgetBunch.__getattr__ work on key instead of id? #98

Open
amol- opened this issue Nov 13, 2013 · 0 comments
Open

Should WidgetBunch.__getattr__ work on key instead of id? #98

amol- opened this issue Nov 13, 2013 · 0 comments

Comments

@amol-
Copy link
Contributor

amol- commented Nov 13, 2013

Currently WidgetBunch.getattr is provided as a quick way to access children for which the identifier is known.

This works pretty well, but it might actually be the case where the id of a widget changes depending on the context where it is rendered. This has the side effect of forcing the developer to implement logic to cope with variables id when using w.children.child_name

While the id might change due to DOM requirements (avoiding collisions) or javascript requirements, the widget key will probably stay the same due to the controller code/layer being usually less variable than the presentation layer.

I know that most of this can be avoided by using automatic ids and referring only to classes for all the JS, semantic meaning and styling of the widgets. But that means that the user should stick to some rules that are not officially enforced by tw2 (I can freely change the id) and are not always enforceable.

Implementatioon should be quick, I can work out a pull request if everyone is fine with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant