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

let data-attribute be optional for attr_value #19

Open
thet opened this issue May 27, 2013 · 1 comment
Open

let data-attribute be optional for attr_value #19

thet opened this issue May 27, 2013 · 1 comment

Comments

@thet
Copy link
Member

thet commented May 27, 2013

attr_value must be called with the attribute-key, the widget instance and a data-dict. this data-dict is not always available, like in cssid: db9619f#L1R152

the 'structural' attribute would be better queried by attr_value('structural', widget, data) to cover callables too, but the data-dict is not available.

attr_value('structural', widget, {}) might be possible, but that seems like a misuse of the API. passing the data-dict to all cssid instances is another option. but maybe the data-dict is not always needed, like in the cssid case. so the call to attr(widget, data) in attr_value would be ok without data. in this case, the attr_value function signature should look like:
attr_value(key, widget, data={}, default=None)

@rnixx
Copy link
Member

rnixx commented Nov 21, 2015

There is a similar issue with property callables in preprocessors where data is not available yet.
+1 for the signature change

@rnixx rnixx added this to the 2.3 milestone Nov 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants