-
Notifications
You must be signed in to change notification settings - Fork 324
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
Passing pre_save_hook as importstring #753
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Try access the __name__ attribute on the function form of the hook, and if it doesn't exist then use the string as the name. Closes jupyter-server#753
Only treat a hook as a replacement if the existing hook is callable. Otherwise treat it as a new hook. Closes jupyter-server#753
Description
Passing a
pre_save_hook
as an importstring e.g.fails with the following error when launching the Jupyter server:
Troubleshoot Output
If you edit
jupyter_server_config.py
to import the function, then setting the value is fine.Reproduce
Pass
pre_save_hook
orpost_save_hook
as a importstring.Expected behavior
Passing as a string or function works equally well.
Discussion
The problem seems to be because the code assumes that
self.pre_save_hook
is always a function and has the__name__
dunder.The text was updated successfully, but these errors were encountered: