-
Notifications
You must be signed in to change notification settings - Fork 338
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
A custom handler with an alias returns an error when using the alias #1514
Comments
I'm not sure aliases make sense for custom fields, since you can already give them any name you want. |
Well, almost any. Most names allowed for aliases aren't allowed for custom fields (like emojis and stuff). |
That makes sense if everything is done statically in code. fieldset = Fieldset()
# file represents an external data source
aliases = json.load(file)
# aliases = { "col 1": "positive_number_under_10"}
fieldset.aliases.update(aliases)
fieldset.register_handlers(
(
("positive_number_under_10", positive_number_under_10),
)
)
data: dict[str, list[Any]] = {}
# columns comes from a database schema
for col in columns:
data[col.name] = fieldset(col.name, i=rows_in_table) Neither the aliases nor the columns are determined before runtime. My (ugly) workaround currently is to make You can see in #1515, you can support aliases and custom handlers by moving a single line of code from _lookup_method to perform. |
I see. I'll merge your PR and release new version later this weekend. Thank you! |
Bug report
Repro:
The text was updated successfully, but these errors were encountered: