##// END OF EJS Templates
Merge pull request #2796 from kmike/cookie-fix...
Min RK -
r9127:ef96c7dd merge
parent child Browse files
Show More
@@ -27,7 +27,6 b' import stat'
27 import threading
27 import threading
28 import time
28 import time
29 import uuid
29 import uuid
30 import os
31
30
32 from tornado.escape import url_escape
31 from tornado.escape import url_escape
33 from tornado import web
32 from tornado import web
@@ -41,6 +40,7 b' from IPython.zmq.session import Session'
41 from IPython.lib.security import passwd_check
40 from IPython.lib.security import passwd_check
42 from IPython.utils.jsonutil import date_default
41 from IPython.utils.jsonutil import date_default
43 from IPython.utils.path import filefind
42 from IPython.utils.path import filefind
43 from IPython.utils.py3compat import PY3
44
44
45 try:
45 try:
46 from docutils.core import publish_string
46 from docutils.core import publish_string
@@ -434,8 +434,9 b' class AuthenticatedZMQStreamHandler(ZMQStreamHandler):'
434 def _inject_cookie_message(self, msg):
434 def _inject_cookie_message(self, msg):
435 """Inject the first message, which is the document cookie,
435 """Inject the first message, which is the document cookie,
436 for authentication."""
436 for authentication."""
437 if isinstance(msg, unicode):
437 if not PY3 and isinstance(msg, unicode):
438 # Cookie can't constructor doesn't accept unicode strings for some reason
438 # Cookie constructor doesn't accept unicode strings
439 # under Python 2.x for some reason
439 msg = msg.encode('utf8', 'replace')
440 msg = msg.encode('utf8', 'replace')
440 try:
441 try:
441 self.request._cookies = Cookie.SimpleCookie(msg)
442 self.request._cookies = Cookie.SimpleCookie(msg)
General Comments 0
You need to be logged in to leave comments. Login now