[py3k] import SimpleCookie using six.moves
authorRémi Cardona <remi.cardona@logilab.fr>
Tue, 22 Sep 2015 15:36:32 +0200
changeset 10605 61521bee2b68
parent 10604 d4bf85db41f2
child 10606 718e78ef6699
[py3k] import SimpleCookie using six.moves
web/request.py
web/test/unittest_application.py
wsgi/__init__.py
--- a/web/request.py	Mon Sep 14 12:40:57 2015 +0200
+++ b/web/request.py	Tue Sep 22 15:36:32 2015 +0200
@@ -24,13 +24,13 @@
 import base64
 from StringIO import StringIO
 from hashlib import sha1 # pylint: disable=E0611
-from Cookie import SimpleCookie
 from calendar import timegm
 from datetime import date, datetime
 from warnings import warn
 
 from six.moves import http_client
 from six.moves.urllib.parse import urlsplit, quote as urlquote
+from six.moves.http_cookies import SimpleCookie
 
 from rql.utils import rqlvar_maker
 
--- a/web/test/unittest_application.py	Mon Sep 14 12:40:57 2015 +0200
+++ b/web/test/unittest_application.py	Tue Sep 22 15:36:32 2015 +0200
@@ -17,9 +17,10 @@
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """unit tests for cubicweb.web.application"""
 
-import base64, Cookie
+import base64
 
 from six.moves import http_client
+from six.moves.http_cookies import SimpleCookie
 
 from logilab.common.testlib import TestCase, unittest_main
 from logilab.common.decorators import clear_cache, classproperty
@@ -362,7 +363,7 @@
     def _reset_cookie(self, req):
         # preparing the suite of the test
         # set session id in cookie
-        cookie = Cookie.SimpleCookie()
+        cookie = SimpleCookie()
         sessioncookie = self.app.session_handler.session_cookie(req)
         cookie[sessioncookie] = req.session.sessionid
         req.set_request_header('Cookie', cookie[sessioncookie].OutputString(),
--- a/wsgi/__init__.py	Mon Sep 14 12:40:57 2015 +0200
+++ b/wsgi/__init__.py	Tue Sep 22 15:36:32 2015 +0200
@@ -27,9 +27,9 @@
 __docformat__ = "restructuredtext en"
 
 from email import message, message_from_string
-from Cookie import SimpleCookie
 from pprint import pformat as _pformat
 
+from six.moves.http_cookies import SimpleCookie
 
 def pformat(obj):
     """pretty prints `obj` if possible"""