Skip to content

Commit

Permalink
Fix wrapt deps in setup.py
Browse files Browse the repository at this point in the history
Signed-off-by: Cliff Woolley <[email protected]>
  • Loading branch information
cliffwoolley committed Feb 16, 2021
1 parent 2cdf371 commit 762ca16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
21 changes: 12 additions & 9 deletions jupyter_tensorboard/handlers.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# -*- coding: utf-8 -*-

import wrapt
from tornado import web
from tornado.wsgi import WSGIContainer
from notebook.base.handlers import IPythonHandler
from notebook.utils import url_path_join as ujoin
from notebook.base.handlers import path_regex

@wrapt.patch_function_wrapper(web.RequestHandler, 'check_xsrf_cookie')
def translate_check_xsrf_cookie(wrapped, instance, args, kwargs):
try:
import wrapt
@wrapt.patch_function_wrapper(web.RequestHandler, 'check_xsrf_cookie')
def translate_check_xsrf_cookie(wrapped, instance, args, kwargs):

if ((instance.request.headers.get("X-XSRF-TOKEN")) and
not (instance.get_argument("_xsrf", None)
or instance.request.headers.get("X-Xsrftoken")
or instance.request.headers.get("X-Csrftoken"))):
if ((instance.request.headers.get("X-XSRF-TOKEN")) and
not (instance.get_argument("_xsrf", None)
or instance.request.headers.get("X-Xsrftoken")
or instance.request.headers.get("X-Csrftoken"))):

instance.request.headers.add("X-Xsrftoken", instance.request.headers.get("X-XSRF-TOKEN"))
instance.request.headers.add("X-Xsrftoken", instance.request.headers.get("X-XSRF-TOKEN"))

wrapped(*args, **kwargs)
wrapped(*args, **kwargs)
except:
pass


notebook_dir = None
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def run(self):
]],
install_requires=[
'notebook>=5.0',
'wrapt>=1.12',
],
classifiers=[
'Intended Audience :: Developers',
Expand Down

0 comments on commit 762ca16

Please sign in to comment.