diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wadllib.egg-info/PKG-INFO | 50 | ||||
-rw-r--r-- | src/wadllib.egg-info/SOURCES.txt | 13 | ||||
-rw-r--r-- | src/wadllib.egg-info/requires.txt | 4 | ||||
-rw-r--r-- | src/wadllib/__init__.py | 9 | ||||
-rw-r--r-- | src/wadllib/application.py | 5 | ||||
-rw-r--r-- | src/wadllib/docs/Makefile | 20 | ||||
-rw-r--r-- | src/wadllib/docs/NEWS.rst (renamed from src/wadllib/NEWS.txt) | 14 | ||||
-rw-r--r-- | src/wadllib/docs/index.rst (renamed from src/wadllib/README.txt) | 34 | ||||
-rw-r--r-- | src/wadllib/tests/test_docs.py | 6 | ||||
-rw-r--r-- | src/wadllib/version.txt | 1 |
10 files changed, 118 insertions, 38 deletions
diff --git a/src/wadllib.egg-info/PKG-INFO b/src/wadllib.egg-info/PKG-INFO index 3fe10f6..ad3aba1 100644 --- a/src/wadllib.egg-info/PKG-INFO +++ b/src/wadllib.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: wadllib -Version: 1.3.4 +Version: 1.3.6 Summary: Navigate HTTP resources using WADL files as guides. Home-page: https://launchpad.net/wadllib Maintainer: LAZR Developers @@ -581,13 +581,6 @@ Description: .. >>> import cgi >>> import io >>> def assert_message_parts(media_type, doc, expected): - ... if sys.version_info[0] == 3 and sys.version_info[1] < 3: - ... # We can't do much due to https://bugs.python.org/issue18013. - ... for value in expected: - ... if not isinstance(value, bytes): - ... value = value.encode('UTF-8') - ... assert value in doc - ... return ... environ = { ... 'REQUEST_METHOD': 'POST', ... 'CONTENT_TYPE': media_type, @@ -618,6 +611,13 @@ Description: .. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text", binary_field=b"\x01\x02\r\x81\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts(media_type, doc, ['text', b'\x01\x02\r\x81\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\n", binary_field=b"\x01\x02\r\x81\n\r") >>> print(media_type) multipart/form-data; boundary=... @@ -626,6 +626,14 @@ Description: .. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text\n", binary_field=b"\x01\x02\r\x81\n\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\n', b'\x01\x02\r\x81\n\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\r\nmore\r\n", ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") >>> print(media_type) @@ -633,6 +641,15 @@ Description: .. >>> assert_message_parts( ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( + ... text_field=u"text\r\nmore\r\n", + ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'text/unknown') >>> method.build_representation(field="value") Traceback (most recent call last): @@ -700,6 +717,20 @@ Description: .. NEWS for wadllib ================ + 1.3.6 (2021-09-13) + ================== + + - Remove buildout support in favour of tox. [bug=922605] + - Adjust versioning strategy to avoid importing pkg_resources, which is slow + in large environments. + + 1.3.5 (2021-01-20) + ================== + + - Drop support for Python 3.2, 3.3, and 3.4. + - Accept Unicode parameter values again when performing multipart/form-data + encoding on Python 2 (broken in 1.3.3). + 1.3.4 (2020-04-29) ================== @@ -825,9 +856,6 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 diff --git a/src/wadllib.egg-info/SOURCES.txt b/src/wadllib.egg-info/SOURCES.txt index 3cbef34..0c64825 100644 --- a/src/wadllib.egg-info/SOURCES.txt +++ b/src/wadllib.egg-info/SOURCES.txt @@ -1,21 +1,20 @@ COPYING.txt -HACKING.txt -MANIFEST.in -README.txt -ez_setup.py +HACKING.rst +NEWS.rst +README.rst setup.py -src/wadllib/NEWS.txt -src/wadllib/README.txt src/wadllib/__init__.py src/wadllib/application.py src/wadllib/iso_strptime.py -src/wadllib/version.txt src/wadllib.egg-info/PKG-INFO src/wadllib.egg-info/SOURCES.txt src/wadllib.egg-info/dependency_links.txt src/wadllib.egg-info/not-zip-safe src/wadllib.egg-info/requires.txt src/wadllib.egg-info/top_level.txt +src/wadllib/docs/Makefile +src/wadllib/docs/NEWS.rst +src/wadllib/docs/index.rst src/wadllib/tests/__init__.py src/wadllib/tests/test_docs.py src/wadllib/tests/data/__init__.py diff --git a/src/wadllib.egg-info/requires.txt b/src/wadllib.egg-info/requires.txt index f0506a0..b479605 100644 --- a/src/wadllib.egg-info/requires.txt +++ b/src/wadllib.egg-info/requires.txt @@ -1,6 +1,8 @@ lazr.uri setuptools +[:python_version < "3.8"] +importlib-metadata + [docs] Sphinx -z3c.recipe.sphinxdoc diff --git a/src/wadllib/__init__.py b/src/wadllib/__init__.py index b50e2b6..3a9845c 100644 --- a/src/wadllib/__init__.py +++ b/src/wadllib/__init__.py @@ -17,9 +17,12 @@ import sys -import pkg_resources -__version__ = pkg_resources.resource_string( - "wadllib", "version.txt").strip() +try: + import importlib.metadata as importlib_metadata +except ImportError: + import importlib_metadata + +__version__ = importlib_metadata.version("wadllib") if sys.version_info[0] >= 3: _string_types = str diff --git a/src/wadllib/application.py b/src/wadllib/application.py index 107d9e4..06a4398 100644 --- a/src/wadllib/application.py +++ b/src/wadllib/application.py @@ -880,8 +880,9 @@ class RepresentationDefinition(WADLResolvableDefinition, HasParametersMixin): raise TypeError('bytes payload expected: %s' % type(value)) buf.write(value) else: - if not isinstance(value, str): - raise TypeError('str payload expected: %s' % type(value)) + if not isinstance(value, _string_types): + raise TypeError( + 'string payload expected: %s' % type(value)) lines = re.split(r'\r\n|\r|\n', value) for line in lines[:-1]: buf.write(line.encode('UTF-8')) diff --git a/src/wadllib/docs/Makefile b/src/wadllib/docs/Makefile new file mode 100644 index 0000000..8cbdfa0 --- /dev/null +++ b/src/wadllib/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = wadllib +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/src/wadllib/NEWS.txt b/src/wadllib/docs/NEWS.rst index 55aae4c..f619422 100644 --- a/src/wadllib/NEWS.txt +++ b/src/wadllib/docs/NEWS.rst @@ -2,6 +2,20 @@ NEWS for wadllib ================ +1.3.6 (2021-09-13) +================== + +- Remove buildout support in favour of tox. [bug=922605] +- Adjust versioning strategy to avoid importing pkg_resources, which is slow + in large environments. + +1.3.5 (2021-01-20) +================== + +- Drop support for Python 3.2, 3.3, and 3.4. +- Accept Unicode parameter values again when performing multipart/form-data + encoding on Python 2 (broken in 1.3.3). + 1.3.4 (2020-04-29) ================== diff --git a/src/wadllib/README.txt b/src/wadllib/docs/index.rst index f4d7fd7..c86faca 100644 --- a/src/wadllib/README.txt +++ b/src/wadllib/docs/index.rst @@ -572,13 +572,6 @@ zope.publisher would. >>> import cgi >>> import io >>> def assert_message_parts(media_type, doc, expected): - ... if sys.version_info[0] == 3 and sys.version_info[1] < 3: - ... # We can't do much due to https://bugs.python.org/issue18013. - ... for value in expected: - ... if not isinstance(value, bytes): - ... value = value.encode('UTF-8') - ... assert value in doc - ... return ... environ = { ... 'REQUEST_METHOD': 'POST', ... 'CONTENT_TYPE': media_type, @@ -609,6 +602,13 @@ zope.publisher would. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text", binary_field=b"\x01\x02\r\x81\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts(media_type, doc, ['text', b'\x01\x02\r\x81\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\n", binary_field=b"\x01\x02\r\x81\n\r") >>> print(media_type) multipart/form-data; boundary=... @@ -617,6 +617,14 @@ zope.publisher would. >>> method = service_root.get_method('post', 'multipart/form-data') >>> media_type, doc = method.build_representation( + ... text_field=u"text\n", binary_field=b"\x01\x02\r\x81\n\r") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\n', b'\x01\x02\r\x81\n\r']) + + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( ... text_field="text\r\nmore\r\n", ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") >>> print(media_type) @@ -624,6 +632,15 @@ zope.publisher would. >>> assert_message_parts( ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'multipart/form-data') + >>> media_type, doc = method.build_representation( + ... text_field=u"text\r\nmore\r\n", + ... binary_field=b"\x01\x02\r\n\x81\r\x82\n") + >>> print(media_type) + multipart/form-data; boundary=... + >>> assert_message_parts( + ... media_type, doc, ['text\r\nmore\r\n', b'\x01\x02\r\n\x81\r\x82\n']) + >>> method = service_root.get_method('post', 'text/unknown') >>> method.build_representation(field="value") Traceback (most recent call last): @@ -691,5 +708,4 @@ match any defined method. .. toctree:: :glob: - * - docs/* + NEWS diff --git a/src/wadllib/tests/test_docs.py b/src/wadllib/tests/test_docs.py index 9cc7b89..b4f3a50 100644 --- a/src/wadllib/tests/test_docs.py +++ b/src/wadllib/tests/test_docs.py @@ -38,12 +38,10 @@ DOCTEST_FLAGS = ( def load_tests(loader, tests, pattern): - doctest_files = [ - os.path.abspath( - pkg_resources.resource_filename('wadllib', 'README.txt'))] + doctest_files = [] if pkg_resources.resource_exists('wadllib', 'docs'): for name in pkg_resources.resource_listdir('wadllib', 'docs'): - if name.endswith('.txt'): + if name.endswith('.rst'): doctest_files.append( os.path.abspath( pkg_resources.resource_filename( diff --git a/src/wadllib/version.txt b/src/wadllib/version.txt deleted file mode 100644 index d0149fe..0000000 --- a/src/wadllib/version.txt +++ /dev/null @@ -1 +0,0 @@ -1.3.4 |