From 0444edcf0254270157f1896eafaeae53a3956ea5 Mon Sep 17 00:00:00 2001 From: Colin Dunklau Date: Tue, 18 Sep 2018 23:44:26 +0200 Subject: Tweak tox links in HACKING.txt Move tox doc link to top, add PyPI link, remove dead codespeak.net link. --- HACKING.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/HACKING.txt b/HACKING.txt index 3a7774781..9416ac210 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -9,8 +9,9 @@ Using a Development Checkout You'll have to create a development environment to hack on Pyramid, using a Pyramid checkout. You can either do this by hand, or if you have ``tox`` -installed (it's on PyPI), you can use ``tox`` to set up a working development -environment. Each installation method is described below. +installed (`docs `_, +`PyPI `), you can use``tox`` to set up a +working development environment. Each installation method is described below. By Hand @@ -89,8 +90,7 @@ way to get going. Since Pyramid is a framework and not an application, it can be convenient to work against a sample application, preferably in its own virtual environment. A -quick way to achieve this is to use `tox -`_ with a custom configuration file +quick way to achieve this is to use `tox` with a custom configuration file that is part of the checkout: $ tox -c hacking-tox.ini @@ -178,8 +178,8 @@ Running Tests $ tox -e py2-cover,py3-cover,coverage -- To run the full set of Pyramid tests on all platforms, install `tox - `_ into a system Python. The ``tox`` console +- To run the full set of Pyramid tests on all platforms, install `tox` into a + system Python. The ``tox`` console script will be installed into the scripts location for that Python. While ``cd``'ed to the Pyramid checkout root directory (it contains ``tox.ini``), invoke the ``tox`` console script. This will read the ``tox.ini`` file and -- cgit v1.2.3 From 1281a5ccffdbf5a5f22da1a38c4c82075ff0505c Mon Sep 17 00:00:00 2001 From: Colin Dunklau Date: Wed, 19 Sep 2018 00:11:59 +0200 Subject: Add registry arg to pyramid.renderers.get_renderer --- CONTRIBUTORS.txt | 1 + pyramid/renderers.py | 10 ++++++++-- pyramid/tests/test_renderers.py | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 0c18d600f..80b43c8ec 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -331,3 +331,4 @@ Contributors - Kuzma Leshakov, 2018/09/07 +- Colin Dunklau, 2018/09/19 diff --git a/pyramid/renderers.py b/pyramid/renderers.py index 6019f50fb..d1c85b371 100644 --- a/pyramid/renderers.py +++ b/pyramid/renderers.py @@ -147,7 +147,7 @@ def render_to_response(renderer_name, return result -def get_renderer(renderer_name, package=None): +def get_renderer(renderer_name, package=None, registry=None): """ Return the renderer object for the renderer ``renderer_name``. You may supply a relative asset spec as ``renderer_name``. If @@ -157,10 +157,16 @@ def get_renderer(renderer_name, package=None): asset specification ``renderer_name``. If ``package`` is ``None`` (the default), the package name of the *caller* of this function will be used as the package. + + You may directly supply an :term:`application registry` using the + ``registry`` argument, and it will be used to look up the renderer. + Otherwise, the current thread-local registry (obtained via + :func:`~pyramid.threadlocal.get_current_registry`) will be used. """ if package is None: package = caller_package() - helper = RendererHelper(name=renderer_name, package=package) + helper = RendererHelper(name=renderer_name, package=package, + registry=registry) return helper.renderer # concrete renderer factory implementations (also API) diff --git a/pyramid/tests/test_renderers.py b/pyramid/tests/test_renderers.py index 86d8b582a..ea5e317d3 100644 --- a/pyramid/tests/test_renderers.py +++ b/pyramid/tests/test_renderers.py @@ -624,6 +624,12 @@ class Test_get_renderer(unittest.TestCase): result = self._callFUT('abc/def.pt', package=pyramid.tests) self.assertEqual(result, renderer) + def test_it_with_registry(self): + renderer = self.config.testing_add_renderer( + 'pyramid.tests:abc/def.pt') + result = self._callFUT('abc/def.pt', registry=self.config.registry) + self.assertEqual(result, renderer) + class TestJSONP(unittest.TestCase): def _makeOne(self, param_name='callback'): from pyramid.renderers import JSONP -- cgit v1.2.3 From 80d7018acff59b34ddfd42031e8d766a803682dd Mon Sep 17 00:00:00 2001 From: Colin Dunklau Date: Wed, 19 Sep 2018 00:21:59 +0200 Subject: Update changelog for 3354 --- CHANGES.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d0dbbe5c0..63c9979f0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -57,6 +57,10 @@ Features - Add support for Python 3.7. Add testing on Python 3.8 with allowed failures. See https://github.com/Pylons/pyramid/pull/3333 +- Add a ``registry`` argument to ``pyramid.renderers.get_renderer`` + to allow users to avoid threadlocals during renderer lookup. + See https://github.com/Pylons/pyramid/pull/3358 + Bug Fixes --------- -- cgit v1.2.3 From b00acf61982a88ad675a81bc08d8ac9c3e8ab92b Mon Sep 17 00:00:00 2001 From: Colin Dunklau Date: Wed, 19 Sep 2018 10:17:33 +0200 Subject: Update copyright Fixes #3355 --- COPYRIGHT.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 645160fa5..6e23cb876 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008-2011 Agendaless Consulting and Contributors. +Copyright (c) 2008-2018 Agendaless Consulting and Contributors. (http://www.agendaless.com), All Rights Reserved Portions (c) Zope Foundation and contributors (http://www.zope.org/). -- cgit v1.2.3 From 081699993078baa817d0d1c220db6a0d87555a44 Mon Sep 17 00:00:00 2001 From: Colin Dunklau Date: Wed, 19 Sep 2018 11:47:42 +0200 Subject: Expunge reST markup, this is a plain text file - Rework tox URLs - Use single graves (not two) to quote literal text - Use parens for inline URLs --- HACKING.txt | 73 ++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/HACKING.txt b/HACKING.txt index 9416ac210..be770484a 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -8,10 +8,13 @@ Using a Development Checkout ---------------------------- You'll have to create a development environment to hack on Pyramid, using a -Pyramid checkout. You can either do this by hand, or if you have ``tox`` -installed (`docs `_, -`PyPI `), you can use``tox`` to set up a -working development environment. Each installation method is described below. +Pyramid checkout. You can either do this by hand, or if you have `tox` +installed, you can use it to set up a working development environment. + +tox docs: http://tox.readthedocs.org/en/latest/ +tox on PyPI: https://pypi.org/project/tox/ + +Each installation method is described below. By Hand @@ -47,20 +50,20 @@ repo, from which you can submit a pull request. $ cd ~/hack-on-pyramid $ python3 -m venv env - From here on in within these instructions, the ``~/hack-on-pyramid/env`` - virtual environment you created above will be referred to as ``$VENV``. + From here on in within these instructions, the `~/hack-on-pyramid/env` + virtual environment you created above will be referred to as `$VENV`. To use the instructions in the steps that follow literally, use the - ``export VENV=~/hack-on-pyramid/env`` command. + `export VENV=~/hack-on-pyramid/env` command. - Install Pyramid from the checkout into the virtual environment, where the - current working directory is the ``pyramid`` checkout directory. We will + current working directory is the `pyramid` checkout directory. We will install Pyramid in editable (development) mode as well as its testing requirements. $ cd ~/hack-on-pyramid $ $VENV/bin/pip install -e ".[testing,docs]" -- Optionally create a new Pyramid project using ``pcreate``: +- Optionally create a new Pyramid project using `pcreate`: $ cd $VENV $ bin/pcreate -s starter starter @@ -71,13 +74,13 @@ repo, from which you can submit a pull request. $ $VENV/bin/pip install -e . -Using ``Tox`` -+++++++++++++ +Using `Tox` ++++++++++++ -Alternatively, if you already have ``tox`` installed, there is an easier +Alternatively, if you already have `tox` installed, there is an easier way to get going. -- Create a new directory somewhere and ``cd`` to it: +- Create a new directory somewhere and `cd` to it: $ mkdir ~/hack-on-pyramid $ cd ~/hack-on-pyramid @@ -95,10 +98,10 @@ that is part of the checkout: $ tox -c hacking-tox.ini -This will create a python-2.7 based virtual environment named ``env27`` -(Pyramid's ``.gitconfig` ignores all top-level folders that start with ``env`` +This will create a python-2.7 based virtual environment named `env27` +(Pyramid's `.gitconfig` ignores all top-level folders that start with `env` specifically in our use case), and inside that a simple pyramid application -named ``hacking`` that you can then fire up like so: +named `hacking` that you can then fire up like so: $ cd env27/hacking $ ../bin/pip install -e ".[testing,docs]" @@ -111,7 +114,7 @@ Adding Features In order to add a feature to Pyramid: - The feature must be documented in both the API and narrative documentation - (in ``docs/``). + (in `docs/`). - The feature must work fully on the following CPython versions: 2.7, 3.4, 3.5, 3.6, and 3.7 on both UNIX and Windows. @@ -127,7 +130,7 @@ In order to add a feature to Pyramid: The above requirements are relaxed for scaffolding dependencies. If a scaffold has an install-time dependency on something that doesn't work on a particular platform, that caveat should be spelled out clearly in *its* documentation -(within its ``docs/`` directory). +(within its `docs/` directory). Coding Style @@ -147,11 +150,11 @@ Running Tests - To run all tests for Pyramid on a single Python version from your development virtual environment (See *Using a Development Checkout* above), run - ``nosetests``: + `nosetests`: $ $VENV/bin/nosetests -- To run individual tests (i.e., during development), you can use ``nosetests`` +- To run individual tests (i.e., during development), you can use `nosetests` syntax as follows: # run a single test @@ -160,14 +163,14 @@ Running Tests # run all tests in a class $ $VENV/bin/nosetests pyramid.tests.test_module:ClassName - Optionally you can install a nose plugin, `nose-selecttests - `_, and use a regular - expression with the ``-t`` parameter to run tests. + Optionally you can install a nose plugin, `nose-selecttests` + ( https://pypi.org/project/nose-selecttests/ ), and use a regular + expression with the `-t` parameter to run tests. # run a single test $ $VENV/bin/nosetests -t test_mytestname -- The ``tox.ini`` uses ``nose`` and ``coverage``. As such ``tox`` may be used +- The `tox.ini` uses `nose` and `coverage`. As such `tox` may be used to run groups of tests or only a specific version of Python. For example, the following command will run tests on Python 2.7 only without coverage: @@ -179,10 +182,10 @@ Running Tests $ tox -e py2-cover,py3-cover,coverage - To run the full set of Pyramid tests on all platforms, install `tox` into a - system Python. The ``tox`` console + system Python. The `tox` console script will be installed into the scripts location for that Python. While - ``cd``'ed to the Pyramid checkout root directory (it contains ``tox.ini``), - invoke the ``tox`` console script. This will read the ``tox.ini`` file and + `cd`'ed to the Pyramid checkout root directory (it contains `tox.ini`), + invoke the `tox` console script. This will read the `tox.ini` file and execute the tests on multiple Python versions and platforms. While it runs, it creates a virtual environment for each version/platform combination. For example: @@ -191,9 +194,9 @@ Running Tests $ cd ~/hack-on-pyramid/ $ /usr/bin/tox -- The tests can also be run using `pytest `_. This is +- The tests can also be run using `pytest` ( http://pytest.org/ ). This is intended as a convenience for people who are more used to or fond of - ``pytest``. Run the tests like so: + `pytest`. Run the tests like so: $ $VENV/bin/pip install pytest $ $VENV/bin/py.test --strict pyramid/ @@ -218,8 +221,8 @@ Test Coverage ------------- - The codebase *must* have 100% test statement coverage after each commit. You - can test coverage via ``./coverage.sh`` (which itself just executes ``tox - -epy2-cover,py3-cover,coverage``). + can test coverage via `./coverage.sh` (which itself just executes `tox + -epy2-cover,py3-cover,coverage`). Documentation Coverage and Building HTML Documentation @@ -230,19 +233,19 @@ documentation in this package which references that API or behavior must be changed to reflect the bug fix, ideally in the same commit that fixes the bug or adds the feature. To build and review docs, use the following steps. -1. In the main Pyramid checkout directory, run ``./builddocs.sh`` (which just - turns around and runs ``tox -e docs``): +1. In the main Pyramid checkout directory, run `./builddocs.sh` (which just + turns around and runs `tox -e docs`): $ ./builddocs.sh -2. Open the ``docs/_build/html/index.html`` file to see the resulting HTML +2. Open the `docs/_build/html/index.html` file to see the resulting HTML rendering. Change Log ---------- -- Feature additions and bugfixes must be added to the ``CHANGES.rst`` +- Feature additions and bugfixes must be added to the `CHANGES.rst` file in the prevailing style. Changelog entries should be long and descriptive, not cryptic. Other developers should be able to know what your changelog entry means. -- cgit v1.2.3 From 6447d59aa63852831ce60e99365dde52427893c9 Mon Sep 17 00:00:00 2001 From: Colin Dunklau Date: Wed, 19 Sep 2018 12:13:32 +0200 Subject: Rewrap paragraph --- HACKING.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/HACKING.txt b/HACKING.txt index be770484a..fdfee58d6 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -182,13 +182,12 @@ Running Tests $ tox -e py2-cover,py3-cover,coverage - To run the full set of Pyramid tests on all platforms, install `tox` into a - system Python. The `tox` console - script will be installed into the scripts location for that Python. While - `cd`'ed to the Pyramid checkout root directory (it contains `tox.ini`), - invoke the `tox` console script. This will read the `tox.ini` file and - execute the tests on multiple Python versions and platforms. While it runs, - it creates a virtual environment for each version/platform combination. For - example: + system Python. The `tox` console script will be installed into the scripts + location for that Python. While `cd`'ed to the Pyramid checkout root + directory (it contains `tox.ini`), invoke the `tox` console script. This + will read the `tox.ini` file and execute the tests on multiple Python + versions and platforms. While it runs, it creates a virtual environment + for each version/platform combination. For example: $ sudo /usr/bin/pip install tox $ cd ~/hack-on-pyramid/ -- cgit v1.2.3 From 2cc524cc0e75e2242f17954c30415fb2b9ad32dd Mon Sep 17 00:00:00 2001 From: Colin Dunklau Date: Wed, 19 Sep 2018 17:08:09 +0200 Subject: Add a test with a different configurator instance --- pyramid/tests/test_renderers.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pyramid/tests/test_renderers.py b/pyramid/tests/test_renderers.py index ea5e317d3..a2f7bf8c2 100644 --- a/pyramid/tests/test_renderers.py +++ b/pyramid/tests/test_renderers.py @@ -630,6 +630,14 @@ class Test_get_renderer(unittest.TestCase): result = self._callFUT('abc/def.pt', registry=self.config.registry) self.assertEqual(result, renderer) + def test_it_with_isolated_registry(self): + from pyramid.config import Configurator + isolated_config = Configurator() + renderer = isolated_config.testing_add_renderer( + 'pyramid.tests:abc/def.pt') + result = self._callFUT('abc/def.pt', registry=isolated_config.registry) + self.assertEqual(result, renderer) + class TestJSONP(unittest.TestCase): def _makeOne(self, param_name='callback'): from pyramid.renderers import JSONP -- cgit v1.2.3 From d275ec131b63dd03f1922990752c5564841275cf Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 21 Sep 2018 18:07:22 -0700 Subject: Add support for RTD Ethical Ads --- docs/conf.py | 9 +++++++++ setup.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 8fe7108ff..6e3d41240 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -161,6 +161,15 @@ html_theme_options = dict( outdated='false', ) +# Control display of sidebars +html_sidebars = {'**': [ + 'localtoc.html', + 'ethicalads.html', + 'relations.html', + 'sourcelink.html', + 'searchbox.html', +]} + # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". html_title = 'The Pyramid Web Framework v%s' % release diff --git a/setup.py b/setup.py index 56f9e30d1..e38dcd656 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ tests_require = [ docs_extras = [ 'Sphinx >= 1.7.4,<=1.7.9', 'docutils', - 'pylons-sphinx-themes', + 'pylons-sphinx-themes >= 1.0.7', 'pylons_sphinx_latesturl', 'repoze.sphinx.autointerface', 'sphinxcontrib-autoprogram', -- cgit v1.2.3 From c8abfbba6414faeb85eb72b9d42825cbedc1ca48 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 21 Sep 2018 18:22:19 -0700 Subject: Add changelog entry --- CHANGES.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d0dbbe5c0..3425a950f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -110,6 +110,10 @@ Backward Incompatibilities Documentation Changes --------------------- +- Ad support for Read The Docs Ethical Ads. + https://github.com/Pylons/pyramid/pull/3360 + https://docs.readthedocs.io/en/latest/advertising/ethical-advertising.html + - Add support for alembic to the pyramid-cookiecutter-alchemy cookiecutter and update the wiki2 tutorial to explain how it works. See https://github.com/Pylons/pyramid/pull/3307 and -- cgit v1.2.3 From eed1d870ba39925c2154418e7ab88b713fb26447 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 21 Sep 2018 18:34:07 -0700 Subject: Use correct minimum version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e38dcd656..0310a2aa4 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ tests_require = [ docs_extras = [ 'Sphinx >= 1.7.4,<=1.7.9', 'docutils', - 'pylons-sphinx-themes >= 1.0.7', + 'pylons-sphinx-themes >= 1.0.8', 'pylons_sphinx_latesturl', 'repoze.sphinx.autointerface', 'sphinxcontrib-autoprogram', -- cgit v1.2.3 From 0296259599809671df9a4bb3b14623c117c09344 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 22 Sep 2018 01:33:35 -0700 Subject: Update links to trypyramid.com, Grok, gunicorn --- docs/glossary.rst | 4 ++-- docs/index.rst | 2 +- docs/narr/introduction.rst | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/glossary.rst b/docs/glossary.rst index 587e7c63e..ec4cffef2 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -343,7 +343,7 @@ Glossary full-featured Python web framework. Grok - `A web framework based on Zope 3 `_. + `A web framework based on Zope 3 `_. Django `A full-featured Python web framework `_. @@ -1083,7 +1083,7 @@ Glossary Green Unicorn Aka ``gunicorn``, a fast :term:`WSGI` server that runs on Unix under - Python 2.6+ or Python 3.1+. See http://gunicorn.org/ for detailed + Python 2.6+ or Python 3.1+. See https://gunicorn.org/ for detailed information. predicate factory diff --git a/docs/index.rst b/docs/index.rst index 76d23b4f4..19cff9414 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -66,7 +66,7 @@ Official tutorials provide a quick overview of :app:`Pyramid`'s features in more Support and Development ======================= -The `Pyramid website `_ is the main +The `Pyramid website `_ is the main entry point to :app:`Pyramid` web framework resources for support and development information. diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst index 3ee6b5367..9293386f2 100644 --- a/docs/narr/introduction.rst +++ b/docs/narr/introduction.rst @@ -52,7 +52,7 @@ Modern Tested ~~~~~~ -Untested code is broken by design. The :app:`Pyramid` community has a strong testing culture and our framework reflects that. Every release of :app:`Pyramid` has 100% statement coverage (as measured by `coverage `_) and 95% decision/condition coverage. (as measured by `instrumental `_) It is automatically tested using `Travis `_ and `Jenkins `_ on supported versions of Python after each commit to its GitHub repository. `Official Pyramid add-ons `_ are held to a similar testing standard. +Untested code is broken by design. The :app:`Pyramid` community has a strong testing culture and our framework reflects that. Every release of :app:`Pyramid` has 100% statement coverage (as measured by `coverage `_) and 95% decision/condition coverage. (as measured by `instrumental `_) It is automatically tested using `Travis `_ and `Jenkins `_ on supported versions of Python after each commit to its GitHub repository. `Official Pyramid add-ons `_ are held to a similar testing standard. We still find bugs in :app:`Pyramid`, but we've noticed we find a lot fewer of them while working on projects with a solid testing regime. @@ -173,7 +173,7 @@ Supported :app:`Pyramid` add-ons are held to the same demanding standards as the .. seealso:: - See also https://trypyramid.com/resources-extending-pyramid.html + See also https://trypyramid.com/extending-pyramid.html Write your views, *your* way ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 473663742fc4015d670a2218ba998fbf9aba92e5 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 22 Sep 2018 01:42:14 -0700 Subject: Bump Sphinx - See #3350 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0310a2aa4..d3d453a0d 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ tests_require = [ docs_extras = [ - 'Sphinx >= 1.7.4,<=1.7.9', + 'Sphinx >= 1.8.1', 'docutils', 'pylons-sphinx-themes >= 1.0.8', 'pylons_sphinx_latesturl', -- cgit v1.2.3