and clarify warning when a base handler isn't patched that auth is still being applied
- reorganize patch steps into functions for easier re-use
- patch notebook and jupyter_server handlers if they are already imported
- run patch after initialize to ensure extensions have done their importing before we check what's present
- apply class-level patch even when instance-level patch is happening to avoid triggering patch on every request
This change isn't as big as it looks, because it's mostly moving some re-used code to a couple of functions.
closes https://github.com/jupyter-server/jupyter_server/issues/488
Signed-off-by: Min RK <benjaminrk@gmail.com>
apply patch directly to BaseHandler instead of each handler instance
so that overrides can still take effect (i.e. APIHandler raising 403 instead of redirecting)
for easier reuse with jupyter_server
mixins have a lot of assumptions about the NotebookApp structure.
Need to make sure these are met by jupyter_server (that's what tests are for!)