summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2019-12-23 11:55:45 -0600
committerGitHub <noreply@github.com>2019-12-23 11:55:45 -0600
commit68d86dae5dd30a667e5f98a370517a7b82c24024 (patch)
treeebef682d7393d673364540ea35836e623c03e9cf
parent5e7f4e10f45e78afe04e18c9f904aebff2d9d6b4 (diff)
parent3f42e5f2c848e69f282337f6fbf56e69b295b58e (diff)
downloadpyramid-68d86dae5dd30a667e5f98a370517a7b82c24024.tar.gz
pyramid-68d86dae5dd30a667e5f98a370517a7b82c24024.tar.bz2
pyramid-68d86dae5dd30a667e5f98a370517a7b82c24024.zip
Merge pull request #9 from stevepiercy/min-py36-add-py38
Update docs and setup.py, remove py35, py36, add py38
-rw-r--r--docs/narr/install.rst6
-rw-r--r--docs/narr/logging.rst2
-rw-r--r--docs/narr/upgrading.rst6
-rw-r--r--docs/quick_tutorial/requirements.rst4
-rw-r--r--docs/tutorials/modwsgi/index.rst2
-rw-r--r--docs/tutorials/wiki/installation.rst2
-rw-r--r--docs/tutorials/wiki/tests.rst3
-rw-r--r--setup.py3
-rw-r--r--src/pyramid/static.py1
-rw-r--r--tests/fixtures/static/only_encoded.html.gzbin0 -> 187 bytes
-rw-r--r--tests/test_static.py80
11 files changed, 92 insertions, 17 deletions
diff --git a/docs/narr/install.rst b/docs/narr/install.rst
index 268ae5f8d..903769b59 100644
--- a/docs/narr/install.rst
+++ b/docs/narr/install.rst
@@ -5,7 +5,7 @@ Installing :app:`Pyramid`
.. note::
- This installation guide emphasizes the use of Python 3.4 and greater for
+ This installation guide emphasizes the use of Python 3.6 and greater for
simplicity.
@@ -15,13 +15,13 @@ Installing :app:`Pyramid`
Before You Install Pyramid
--------------------------
-Install Python version 3.4 or greater for your operating system, and satisfy
+Install Python version 3.6 or greater for your operating system, and satisfy
the :ref:`requirements-for-installing-packages`, as described in
the following sections.
.. sidebar:: Python Versions
- As of this writing, :app:`Pyramid` is tested against Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 (with allowed failures), and PyPy3.
+ As of this writing, :app:`Pyramid` is tested against Python 3.6, Python 3.7, Python 3.8, and PyPy3.
:app:`Pyramid` is known to run on all popular Unix-like systems such as Linux,
macOS, and FreeBSD, as well as on Windows platforms. It is also known to
diff --git a/docs/narr/logging.rst b/docs/narr/logging.rst
index 58bd2d4ec..844128758 100644
--- a/docs/narr/logging.rst
+++ b/docs/narr/logging.rst
@@ -32,7 +32,7 @@ you to send messages to :mod:`Python standard library logging package
:term:`PasteDeploy` ``development.ini`` and ``production.ini`` files created
when you use our cookiecutter include a basic configuration for the Python
:mod:`logging` package.
-These ``.ini`` file sections are passed to the `logging module's config file configuration engine <https://docs.python.org/3.7/howto/logging.html#configuring-logging>`_.
+These ``.ini`` file sections are passed to the `logging module's config file configuration engine <https://docs.python.org/3/howto/logging.html#configuring-logging>`_.
PasteDeploy ``.ini`` files use the Python standard library :mod:`ConfigParser
format <ConfigParser>`. This is the same format used as the Python
diff --git a/docs/narr/upgrading.rst b/docs/narr/upgrading.rst
index af552741c..31ca6adfa 100644
--- a/docs/narr/upgrading.rst
+++ b/docs/narr/upgrading.rst
@@ -86,10 +86,10 @@ At the time of a Pyramid version release, each supports all versions of Python
through the end of their lifespans. The end-of-life for a given version of
Python is when security updates are no longer released.
-- `Python 3.4 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2019-03-16 .
-- `Python 3.5 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2020-09-13 .
+- `Python 3.5 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2020-09-13.
- `Python 3.6 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2021-12-23.
-- `Python 3.7 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2023-06-27 .
+- `Python 3.7 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2023-06-27.
+- `Python 3.8 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2024-10-??.
To determine the Python support for a specific release of Pyramid, view its
``tox.ini`` file at the root of the repository's version.
diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst
index 2ed9b8b55..901f6134d 100644
--- a/docs/quick_tutorial/requirements.rst
+++ b/docs/quick_tutorial/requirements.rst
@@ -19,8 +19,8 @@ virtual environment.)
This *Quick Tutorial* is based on:
-* **Python 3.7**. Pyramid fully supports Python 3.4+.
- This tutorial uses **Python 3.7**.
+* **Python 3.8**. Pyramid fully supports Python 3.6+.
+ This tutorial uses **Python 3.8**.
* **venv**. We believe in virtual environments.
For this tutorial, we use Python 3's built-in solution :term:`venv`.
diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst
index fa0d4f0cb..be72c014c 100644
--- a/docs/tutorials/modwsgi/index.rst
+++ b/docs/tutorials/modwsgi/index.rst
@@ -117,7 +117,7 @@ specific path information for commands and files.
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=chrism group=staff threads=4 \
- python-path=/Users/chrism/myproject/env/lib/python3.5/site-packages
+ python-path=/Users/chrism/myproject/env/lib/python3.8/site-packages
WSGIScriptAlias /myapp /Users/chrism/myproject/pyramid.wsgi
<Directory /Users/chrism/myproject>
diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst
index 37e3498b2..cfa021540 100644
--- a/docs/tutorials/wiki/installation.rst
+++ b/docs/tutorials/wiki/installation.rst
@@ -127,8 +127,6 @@ On Unix
On Windows
^^^^^^^^^^
-Python 3.7:
-
.. code-block:: doscon
python -m venv %VENV%
diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst
index a0872e605..9dacc5f96 100644
--- a/docs/tutorials/wiki/tests.rst
+++ b/docs/tutorials/wiki/tests.rst
@@ -73,6 +73,3 @@ The expected result should look like the following:
.........................
25 passed in 6.87 seconds
-
-If you use Python 3.7, you may see deprecation warnings from the docutils 0.14 package.
-You can apply a [patch](https://sourceforge.net/p/docutils/patches/144/) to fix the issue, or ignore it and wait for the next release of docutils.
diff --git a/setup.py b/setup.py
index 189f0700f..02abf6471 100644
--- a/setup.py
+++ b/setup.py
@@ -69,10 +69,9 @@ setup(
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.4",
- "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: Pyramid",
diff --git a/src/pyramid/static.py b/src/pyramid/static.py
index 7870b803e..499706554 100644
--- a/src/pyramid/static.py
+++ b/src/pyramid/static.py
@@ -236,6 +236,7 @@ class static_view(object):
for path, encoding in files:
if encoding in acceptable_encodings:
return path, encoding
+ return None, None
def add_slash_redirect(self, request):
url = request.path_url + '/'
diff --git a/tests/fixtures/static/only_encoded.html.gz b/tests/fixtures/static/only_encoded.html.gz
new file mode 100644
index 000000000..afcc25768
--- /dev/null
+++ b/tests/fixtures/static/only_encoded.html.gz
Binary files differ
diff --git a/tests/test_static.py b/tests/test_static.py
index 3d0deda3f..7b6e74a64 100644
--- a/tests/test_static.py
+++ b/tests/test_static.py
@@ -458,6 +458,86 @@ class Test_static_view_content_encodings(unittest.TestCase):
self.assertEqual(res.headers['Content-Encoding'], 'gzip')
self.assertEqual(len(res.body), 187)
+ def test_call_for_encoded_variant_without_unencoded_variant_no_accept(
+ self,
+ ):
+ inst = self._makeOne(
+ 'tests:fixtures/static', content_encodings=['gzip']
+ )
+ request = self._makeRequest({'PATH_INFO': '/only_encoded.html.gz'})
+ context = DummyContext()
+
+ res = inst(context, request)
+ self.assertNotIn('Vary', res.headers)
+ self.assertNotIn('Content-Encoding', res.headers)
+ self.assertEqual(len(res.body), 187)
+
+ def test_call_for_encoded_variant_without_unencoded_variant_with_accept(
+ self,
+ ):
+ inst = self._makeOne(
+ 'tests:fixtures/static', content_encodings=['gzip']
+ )
+ request = self._makeRequest(
+ {
+ 'PATH_INFO': '/only_encoded.html.gz',
+ 'HTTP_ACCEPT_ENCODING': 'gzip',
+ }
+ )
+ context = DummyContext()
+
+ res = inst(context, request)
+ self.assertNotIn('Vary', res.headers)
+ self.assertNotIn('Content-Encoding', res.headers)
+ self.assertEqual(len(res.body), 187)
+
+ def test_call_for_unencoded_variant_with_only_encoded_variant_no_accept(
+ self,
+ ):
+ from pyramid.httpexceptions import HTTPNotFound
+
+ inst = self._makeOne(
+ 'tests:fixtures/static', content_encodings=['gzip']
+ )
+ request = self._makeRequest({'PATH_INFO': '/only_encoded.html'})
+ context = DummyContext()
+
+ self.assertRaises(HTTPNotFound, lambda: inst(context, request))
+
+ def test_call_for_unencoded_variant_with_only_encoded_variant_with_accept(
+ self,
+ ):
+ inst = self._makeOne(
+ 'tests:fixtures/static', content_encodings=['gzip']
+ )
+ request = self._makeRequest(
+ {
+ 'PATH_INFO': '/only_encoded.html',
+ 'HTTP_ACCEPT_ENCODING': 'gzip',
+ }
+ )
+ context = DummyContext()
+
+ res = inst(context, request)
+ self.assertNotIn('Vary', res.headers)
+ self.assertEqual(res.headers['Content-Encoding'], 'gzip')
+ self.assertEqual(len(res.body), 187)
+
+ def test_call_for_unencoded_variant_with_only_encoded_variant_bad_accept(
+ self,
+ ):
+ from pyramid.httpexceptions import HTTPNotFound
+
+ inst = self._makeOne(
+ 'tests:fixtures/static', content_encodings=['gzip']
+ )
+ request = self._makeRequest(
+ {'PATH_INFO': '/only_encoded.html', 'HTTP_ACCEPT_ENCODING': 'br'}
+ )
+ context = DummyContext()
+
+ self.assertRaises(HTTPNotFound, lambda: inst(context, request))
+
def test_call_get_possible_files_is_cached(self):
inst = self._makeOne('tests:fixtures/static')
result1 = inst.get_possible_files('tests:fixtures/static/encoded.html')