Commit 4f477d68 authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeTestCase: backport Zope pull request 1059

This is a simplified version that works well enough for python 2.
For Zope 4 and python 3 we are considering reusing publish.
parent bd7a8fb7
......@@ -22,6 +22,7 @@ import urllib
import ConfigParser
from contextlib import contextmanager
from six.moves import cStringIO as StringIO
from six.moves.urllib.parse import unquote_to_bytes
from cPickle import dumps
from glob import glob
from hashlib import md5
......@@ -784,13 +785,14 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
env['HTTP_ACCEPT_CHARSET'] = request['HTTP_ACCEPT_CHARSET']
env['REQUEST_METHOD'] = request_method
p = path.split('?')
if len(p) == 1:
env['PATH_INFO'] = p[0]
elif len(p) == 2:
[env['PATH_INFO'], env['QUERY_STRING']] = p
query = ''
if '?' in path:
path, query = path.split("?", 1)
if six.PY2:
env['PATH_INFO'] = unquote_to_bytes(path)
else:
raise TypeError('')
env['PATH_INFO'] = unquote_to_bytes(path).decode('latin-1')
env['QUERY_STRING'] = query
if basic:
assert not user, (basic, user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment