diff options
| -rw-r--r-- | docs/Makefile | 2 | ||||
| -rw-r--r-- | docs/narr/i18n.rst | 2 | ||||
| -rw-r--r-- | docs/narr/muchadoabouttraversal.rst | 4 | ||||
| -rw-r--r-- | docs/narr/urldispatch.rst | 2 | ||||
| -rw-r--r-- | pyramid/compat.py | 2 | ||||
| -rw-r--r-- | pyramid/config/views.py | 3 | ||||
| -rw-r--r-- | pyramid/mako_templating.py | 4 | ||||
| -rw-r--r-- | pyramid/tests/test_config/test_views.py | 18 | ||||
| -rw-r--r-- | rtd_requirements.txt (renamed from requirements.txt) | 0 |
9 files changed, 28 insertions, 9 deletions
diff --git a/docs/Makefile b/docs/Makefile index d3a83facc..373d549af 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -23,7 +23,7 @@ help: @echo " linkcheck to check all external links for integrity" clean: - -rm -rf _build/* + -rm -rf _build/* _themes html: _themes mkdir -p _build/html _build/doctrees diff --git a/docs/narr/i18n.rst b/docs/narr/i18n.rst index 631654d32..c5e6a9062 100644 --- a/docs/narr/i18n.rst +++ b/docs/narr/i18n.rst @@ -249,7 +249,7 @@ GNU gettext uses three types of files in the translation framework, The tools for working with :term:`gettext` translation files related to a :app:`Pyramid` application is :term:`Babel` and :term:`Lingua`. Lingua is a -Balel extension that provides support for scraping i18n references out of +Babel extension that provides support for scraping i18n references out of Python and Chameleon files. .. index:: diff --git a/docs/narr/muchadoabouttraversal.rst b/docs/narr/muchadoabouttraversal.rst index a948e57cc..4a249ed0d 100644 --- a/docs/narr/muchadoabouttraversal.rst +++ b/docs/narr/muchadoabouttraversal.rst @@ -4,7 +4,9 @@ Much Ado About Traversal ======================== -.. note:: This chapter was adapted, with permission, from a blog post by `Rob +.. note:: + + This chapter was adapted, with permission, from a blog post by `Rob Miller <http://blog.nonsequitarian.org/>`_, originally published at http://blog.nonsequitarian.org/2010/much-ado-about-traversal/ . diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index c2414965c..35613ea1b 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -101,7 +101,7 @@ that references ``myroute`` as a ``route_name`` parameter: def myview(request): return Response('OK') -THe above combination of ``add_route`` and ``scan`` is completely equivalent +The above combination of ``add_route`` and ``scan`` is completely equivalent to using the previous combination of ``add_route`` and ``add_view``. .. index:: diff --git a/pyramid/compat.py b/pyramid/compat.py index 3ac235b0f..73f52b617 100644 --- a/pyramid/compat.py +++ b/pyramid/compat.py @@ -101,6 +101,8 @@ if PY3: # pragma: no cover def reraise(tp, value, tb=None): + if value is None: + value = tp if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value diff --git a/pyramid/config/views.py b/pyramid/config/views.py index 179d4065c..a88c22b12 100644 --- a/pyramid/config/views.py +++ b/pyramid/config/views.py @@ -1,4 +1,5 @@ import inspect +import operator from zope.interface import Interface from zope.interface import classProvides @@ -481,7 +482,7 @@ class MultiView(object): if accept is None or '*' in accept: self.views.append((order, view, phash)) - self.views.sort() + self.views.sort(key=operator.itemgetter(0)) else: subset = self.media_views.setdefault(accept, []) subset.append((order, view, phash)) diff --git a/pyramid/mako_templating.py b/pyramid/mako_templating.py index cb8f0b264..e4571ba1b 100644 --- a/pyramid/mako_templating.py +++ b/pyramid/mako_templating.py @@ -8,7 +8,7 @@ from zope.interface import Interface from pyramid.asset import resolve_asset_spec from pyramid.asset import abspath_from_asset_spec from pyramid.compat import is_nonstr_iter -from pyramid.exceptions import ConfigurationError +from pyramid.compat import reraise from pyramid.interfaces import ITemplateRenderer from pyramid.settings import asbool from pyramid.util import DottedNameResolver @@ -151,7 +151,7 @@ class MakoLookupTemplateRenderer(object): error=exc_info[1], traceback=exc_info[2] ) - raise MakoRenderingException(errtext) + reraise(MakoRenderingException(errtext), None, exc_info[2]) finally: del exc_info diff --git a/pyramid/tests/test_config/test_views.py b/pyramid/tests/test_config/test_views.py index 0813eecdb..fa263a311 100644 --- a/pyramid/tests/test_config/test_views.py +++ b/pyramid/tests/test_config/test_views.py @@ -1844,9 +1844,23 @@ class TestMultiView(unittest.TestCase): mv.add('view', 100, phash='abc') self.assertEqual(mv.views, [(100, 'view', 'abc')]) mv.add('view', 100, phash='def') - self.assertEqual(mv.views, [(100, 'view', 'abc'), (100, 'view', 'def')]) + self.assertEqual(mv.views, [(100, 'view', 'abc'), + (100, 'view', 'def')]) mv.add('view', 100, phash='abc') - self.assertEqual(mv.views, [(100, 'view', 'abc'), (100, 'view', 'def')]) + self.assertEqual(mv.views, [(100, 'view', 'abc'), + (100, 'view', 'def')]) + + def test_multiple_with_functions_as_views(self): + # this failed on py3 at one point, because functions aren't orderable + # and we were sorting the views via a plain sort() rather than + # sort(key=itemgetter(0)). + def view1(request): pass + def view2(request): pass + mv = self._makeOne() + mv.add(view1, 100, None) + self.assertEqual(mv.views, [(100, view1, None)]) + mv.add(view2, 100, None) + self.assertEqual(mv.views, [(100, view1, None), (100, view2, None)]) def test_get_views_request_has_no_accept(self): request = DummyRequest() diff --git a/requirements.txt b/rtd_requirements.txt index 9de7ff3bb..9de7ff3bb 100644 --- a/requirements.txt +++ b/rtd_requirements.txt |
