Commit f8450a92 authored by Colin Watson's avatar Colin Watson

New upstream version 0.14.2

parent 286cd8d8
Metadata-Version: 2.1
Name: lazr.restfulclient
Version: 0.14.1
Version: 0.14.2
Summary: A programmable client library that takes advantage of the commonalities among
Home-page: https://launchpad.net/lazr.restfulclient
Maintainer: LAZR Developers
......@@ -61,6 +61,14 @@ Description: ..
NEWS for lazr.restfulclient
===========================
0.14.2 (2018-11-17)
===================
- Fix compatibility with httplib2 0.12.0 for Python 3. [bug=1803754]
- Really fix compatibility with httplib2 < 0.9.
- Fix compatibility with httplib2 0.9 for Python 3.
- Require httplib >= 0.7.7 for Python 3.
0.14.1 (2018-11-16)
===================
......
......@@ -64,7 +64,8 @@ setup(
license='LGPL v3',
install_requires=[
'distro',
'httplib2',
'httplib2; python_version < "3"',
'httplib2>=0.7.7; python_version >= "3"',
'oauthlib',
'setuptools',
'six',
......
Metadata-Version: 2.1
Name: lazr.restfulclient
Version: 0.14.1
Version: 0.14.2
Summary: A programmable client library that takes advantage of the commonalities among
Home-page: https://launchpad.net/lazr.restfulclient
Maintainer: LAZR Developers
......@@ -61,6 +61,14 @@ Description: ..
NEWS for lazr.restfulclient
===========================
0.14.2 (2018-11-17)
===================
- Fix compatibility with httplib2 0.12.0 for Python 3. [bug=1803754]
- Really fix compatibility with httplib2 < 0.9.
- Fix compatibility with httplib2 0.9 for Python 3.
- Require httplib >= 0.7.7 for Python 3.
0.14.1 (2018-11-16)
===================
......
distro
httplib2
oauthlib
setuptools
six
wadllib>=1.1.4
[:python_version < "3"]
httplib2
[:python_version >= "3"]
httplib2>=0.7.7
[docs]
Sphinx
......
......@@ -32,6 +32,7 @@ __all__ = [
import atexit
import errno
from hashlib import md5
import os
import re
import shutil
......@@ -42,7 +43,6 @@ import tempfile
from time import sleep
from httplib2 import (
Http,
proxy_info_from_environment,
urlnorm,
)
try:
......@@ -82,10 +82,14 @@ else:
str_types = str
# A drop-in replacement for httplib2's safename.
from httplib2 import _md5, re_url_scheme
# A drop-in replacement for httplib2's safename. Substantially borrowed
# from httplib2, but its cache name format changed in 0.12.0 and we want to
# stick with the previous version.
re_url_scheme = re.compile(br'^\w+://')
re_url_scheme_s = re.compile(r'^\w+://')
re_slash = re.compile(br'[?/:|]+')
re_slash = re.compile(r'[?/:|]+')
def safename(filename):
"""Return a filename suitable for the cache.
......@@ -93,14 +97,13 @@ def safename(filename):
Strips dangerous and common characters to create a filename we
can use to store the cache in.
"""
try:
if isinstance(filename, unicode_type):
filename_match = filename.encode('utf-8')
if isinstance(filename, bytes):
filename_match = filename.decode('utf-8')
else:
filename_match = filename
if re_url_scheme.match(filename_match):
if re_url_scheme_s.match(filename_match):
if isinstance(filename, bytes):
filename = filename.decode('utf-8')
filename = filename.encode('idna')
......@@ -110,7 +113,7 @@ def safename(filename):
pass
if isinstance(filename, unicode_type):
filename = filename.encode('utf-8')
filemd5 = _md5(filename).hexdigest()
filemd5 = md5(filename).hexdigest()
filename = re_url_scheme.sub(b"", filename)
filename = re_slash.sub(b",", filename)
......@@ -131,7 +134,7 @@ def safename(filename):
maximum_filename_length = RestfulHttp.maximum_cache_filename_length
maximum_length_before_md5_sum = maximum_filename_length - 32 - 1
if len(filename) > maximum_length_before_md5_sum:
filename=filename[:maximum_length_before_md5_sum]
filename = filename[:maximum_length_before_md5_sum]
return ",".join((filename.decode('utf-8'), filemd5))
......
......@@ -258,4 +258,9 @@ class OAuthAuthorizer(HttpAuthorizer):
client.resource_owner_key = TruthyString(client.resource_owner_key)
_, signed_headers, _ = client.sign(absolute_uri)
for key, value in signed_headers.items():
headers[key.encode('UTF-8')] = value.encode('UTF-8')
# client.sign returns Unicode headers; convert these to native
# strings.
if six.PY2:
key = key.encode('UTF-8')
value = value.encode('UTF-8')
headers[key] = value
......@@ -2,6 +2,14 @@
NEWS for lazr.restfulclient
===========================
0.14.2 (2018-11-17)
===================
- Fix compatibility with httplib2 0.12.0 for Python 3. [bug=1803754]
- Really fix compatibility with httplib2 < 0.9.
- Fix compatibility with httplib2 0.9 for Python 3.
- Require httplib >= 0.7.7 for Python 3.
0.14.1 (2018-11-16)
===================
......
......@@ -32,7 +32,8 @@ else:
import httplib2
from lazr.restfulclient._browser import AtomicFileCache
from lazr.restfulclient._browser import (
AtomicFileCache, safename)
class TestFileCacheInterface(unittest.TestCase):
......@@ -53,7 +54,7 @@ class TestFileCacheInterface(unittest.TestCase):
def make_file_cache(self):
"""Make a FileCache-like object to be tested."""
return self.file_cache_factory(self.cache_dir)
return self.file_cache_factory(self.cache_dir, safename)
def test_get_non_existent_key(self):
# get() returns None if the key does not exist.
......
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