From bd17ff5e424ac25c60d197e3ba8cdb45b05a6a13 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 3 Apr 2013 03:08:28 -0500 Subject: fix #954 --- pyramid/config/views.py | 4 +++- pyramid/tests/test_config/test_views.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pyramid/config/views.py b/pyramid/config/views.py index 1c7620e67..707c84043 100644 --- a/pyramid/config/views.py +++ b/pyramid/config/views.py @@ -257,7 +257,9 @@ class ViewDeriver(object): view_name = getattr(request, 'view_name', None) if self.authn_policy and self.authz_policy: - if permission is None: + if permission is NO_PERMISSION_REQUIRED: + msg = 'Allowed (NO_PERMISSION_REQUIRED)' + elif permission is None: msg = 'Allowed (no permission registered)' else: principals = self.authn_policy.effective_principals( diff --git a/pyramid/tests/test_config/test_views.py b/pyramid/tests/test_config/test_views.py index 5388001f6..94bc497ba 100644 --- a/pyramid/tests/test_config/test_views.py +++ b/pyramid/tests/test_config/test_views.py @@ -2791,7 +2791,8 @@ class TestViewDeriver(unittest.TestCase): self.assertEqual(len(logger.messages), 1) self.assertEqual(logger.messages[0], "debug_authorization of url url (view name " - "'view_name' against context None): False") + "'view_name' against context None): " + "Allowed (NO_PERMISSION_REQUIRED)") def test_secured_view_authn_policy_no_authz_policy(self): response = DummyResponse() -- cgit v1.2.3 From 20c57e6cbdd28fba9fa660d6d47f940a6b9c730b Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 3 Apr 2013 03:57:07 -0500 Subject: update changelog --- CHANGES.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 9d400f5b2..08e498b7a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -82,6 +82,11 @@ Bug Fixes broken when support for the new makodef syntax was added in 1.4a1. See https://github.com/Pylons/pyramid/issues/950 +- ``pyramid.debug_authorization=true`` will now correctly print out + ``Allowed`` for views registered with ``NO_PERMISSION_REQUIRED`` instead + of invoking the ``permits`` method of the authorization policy. + See https://github.com/Pylons/pyramid/issues/954 + 1.4 (2012-12-18) ================ -- cgit v1.2.3 From 922e9d585d6b61e0a2261d6d45363890fe719d4f Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 3 Apr 2013 19:58:23 +0200 Subject: add zope.component to intersphinx_mapping dict --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index ce1d1cce1..1ddcae08e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,6 +55,7 @@ extensions = [ # Looks for objects in external projects intersphinx_mapping = { + 'zcomponent': ('http://docs.zope.org/zope.component', None), 'webtest': ('http://webtest.pythonpaste.org/en/latest', None), 'webob': ('http://docs.webob.org/en/latest', None), 'sqla': ('http://docs.sqlalchemy.org/en/latest', None), -- cgit v1.2.3 From e3d07fd8792bb06c69909e2b664403ae3bbba5d3 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 3 Apr 2013 19:59:45 +0200 Subject: add some more cross-references Also remove linenos setting, which is overkill for a one-liner. --- docs/narr/zca.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/narr/zca.rst b/docs/narr/zca.rst index 2ef8a7373..b0e9b1709 100644 --- a/docs/narr/zca.rst +++ b/docs/narr/zca.rst @@ -83,7 +83,7 @@ While this services a reasonable goal, it causes some issues when trying to use patterns which you might use to build a typical :term:`Zope` application to build a :app:`Pyramid` application. Without special help, ZCA "global" APIs such as -``zope.component.getUtility`` and ``zope.component.getSiteManager`` +:func:`zope.component.getUtility` and :func:`zope.component.getSiteManager` will use the ZCA "global" registry. Therefore, these APIs will appear to fail when used in a :app:`Pyramid` application, because they'll be consulting the ZCA global registry rather than the @@ -104,8 +104,8 @@ Disusing the Global ZCA API +++++++++++++++++++++++++++ ZCA "global" API functions such as ``zope.component.getSiteManager``, -``zope.component.getUtility``, ``zope.component.getAdapter``, and -``zope.component.getMultiAdapter`` aren't strictly necessary. Every +``zope.component.getUtility``, :func:`zope.component.getAdapter`, and +:func:`zope.component.getMultiAdapter` aren't strictly necessary. Every component registry has a method API that offers the same functionality; it can be used instead. For example, presuming the ``registry`` value below is a Zope Component Architecture component @@ -113,7 +113,6 @@ registry, the following bit of code is equivalent to ``zope.component.getUtility(IFoo)``: .. code-block:: python - :linenos: registry.getUtility(IFoo) -- cgit v1.2.3 From f758ec6487bb3b57fb5b1c3aa9ac1f28930d6bd8 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 5 Apr 2013 00:00:44 +0200 Subject: fix some cross-references --- docs/narr/scaffolding.rst | 2 +- docs/narr/security.rst | 2 +- docs/narr/subrequest.rst | 8 ++++---- docs/narr/threadlocals.rst | 2 +- docs/narr/viewconfig.rst | 7 ++++--- docs/narr/webob.rst | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/narr/scaffolding.rst b/docs/narr/scaffolding.rst index 9ac579a87..420aac2dc 100644 --- a/docs/narr/scaffolding.rst +++ b/docs/narr/scaffolding.rst @@ -95,7 +95,7 @@ because that's the name we gave it in the entry point setup. Running output directory named ``MyStuff``. See the module documentation for :mod:`pyramid.scaffolds` for information -about the API of the :class:`pyramid.scaffolds.PyramidScaffold` class and +about the API of the :class:`pyramid.scaffolds.Template` class and related classes. You can override methods of this class to get special behavior. diff --git a/docs/narr/security.rst b/docs/narr/security.rst index e91e8c542..6517fedf8 100644 --- a/docs/narr/security.rst +++ b/docs/narr/security.rst @@ -331,7 +331,7 @@ A principal is usually a user id, however it also may be a group id if your authentication system provides group information and the effective :term:`authentication policy` policy is written to respect group information. For example, the -:class:`pyramid.authentication.RepozeWho1AuthenicationPolicy` respects group +:class:`pyramid.authentication.RepozeWho1AuthenticationPolicy` respects group information if you configure it with a ``callback``. Each ACE in an ACL is processed by an authorization policy *in the diff --git a/docs/narr/subrequest.rst b/docs/narr/subrequest.rst index 93ce747ee..6437bd0fa 100644 --- a/docs/narr/subrequest.rst +++ b/docs/narr/subrequest.rst @@ -223,16 +223,16 @@ unconditionally: :meth:`~pyramid.config.Configurator.set_request_property`) on the subrequest object passed as ``request`` -- causes a :class:`~pyramid.event.NewRequest` event to be sent at the +- causes a :class:`~pyramid.events.NewRequest` event to be sent at the beginning of request processing. -- causes a :class:`~pyramid.event.ContextFound` event to be sent when a +- causes a :class:`~pyramid.events.ContextFound` event to be sent when a context resource is found. - + - Ensures that the user implied by the request passed has the necessary authorization to invoke view callable before calling it. -- causes a :class:`~pyramid.event.NewResponse` event to be sent when the +- causes a :class:`~pyramid.events.NewResponse` event to be sent when the Pyramid application returns a response. - Calls any :term:`response callback` functions defined within the subrequest's diff --git a/docs/narr/threadlocals.rst b/docs/narr/threadlocals.rst index 5ff70565c..a90ee4905 100644 --- a/docs/narr/threadlocals.rst +++ b/docs/narr/threadlocals.rst @@ -129,7 +129,7 @@ follows: ever be called within application-specific forks of third-party library code. The library you've forked almost certainly has nothing to do with :app:`Pyramid`, and making it dependent on - :app:`Pyramid` (rather than making your :mod:`pyramid` + :app:`Pyramid` (rather than making your :app:`pyramid` application depend upon it) means you're forming a dependency in the wrong direction. diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst index 6f0001f61..241ce62b5 100644 --- a/docs/narr/viewconfig.rst +++ b/docs/narr/viewconfig.rst @@ -908,10 +908,11 @@ per :ref:`protecting_views`. .. _debug_notfound_section: -:exc:`NotFound` Errors -~~~~~~~~~~~~~~~~~~~~~~ +:exc:`~pyramid.exceptions.NotFound` Errors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -It's useful to be able to debug :exc:`NotFound` error responses when they +It's useful to be able to debug :exc:`~pyramid.exceptions.NotFound` +error responses when they occur unexpectedly due to an application registry misconfiguration. To debug these errors, use the ``PYRAMID_DEBUG_NOTFOUND`` environment variable or the ``pyramid.debug_notfound`` configuration file setting. Details of why a view diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst index 02c03c8db..c0ca450b1 100644 --- a/docs/narr/webob.rst +++ b/docs/narr/webob.rst @@ -487,7 +487,7 @@ module. Each class is named ``pyramid.httpexceptions.HTTP*``, where ``*`` is the reason for the error. For instance, :class:`pyramid.httpexceptions.HTTPNotFound` subclasses -:class:`pyramid.Response`, so you can manipulate the instances in the same +:class:`pyramid.response.Response`, so you can manipulate the instances in the same way. A typical example is: .. code-block:: python -- cgit v1.2.3 From 5e28d6fa6f2add7bd82aecad45f24c7c4672a253 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 5 Apr 2013 08:58:01 +0200 Subject: fix markup --- docs/narr/scaffolding.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/narr/scaffolding.rst b/docs/narr/scaffolding.rst index 420aac2dc..0d1e3f448 100644 --- a/docs/narr/scaffolding.rst +++ b/docs/narr/scaffolding.rst @@ -74,11 +74,15 @@ concrete examples of scaffold directories (``zodb``, ``alchemy``, and After you've created the template directory, add the following to the ``entry_points`` value of your distribution's ``setup.py``: - [pyramid.scaffold] - coolextension=coolextension.scaffolds:CoolExtensionTemplate +.. code-block:: ini + + [pyramid.scaffold] + coolextension=coolextension.scaffolds:CoolExtensionTemplate For example:: +.. code-block:: python + def setup( ..., entry_points = """\ -- cgit v1.2.3 From 9e7c30d777a29cb69629f4080941c8cb456a3eb5 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 5 Apr 2013 22:27:28 +0200 Subject: fix markup --- docs/narr/scaffolding.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/scaffolding.rst b/docs/narr/scaffolding.rst index 0d1e3f448..534b2caf4 100644 --- a/docs/narr/scaffolding.rst +++ b/docs/narr/scaffolding.rst @@ -79,7 +79,7 @@ After you've created the template directory, add the following to the [pyramid.scaffold] coolextension=coolextension.scaffolds:CoolExtensionTemplate -For example:: +For example: .. code-block:: python -- cgit v1.2.3 From e556961d789ccf52430d19d44297cceb1f537405 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 5 Apr 2013 22:33:18 +0200 Subject: replace a sentence that doesn't quite fit It's as if pyramid_traversalwrapper was already introduced. --- docs/narr/resources.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst index a24c44f29..699a3d4ac 100644 --- a/docs/narr/resources.rst +++ b/docs/narr/resources.rst @@ -171,7 +171,7 @@ you will reach the filesystem root directory. URL generated (as opposed to a single leading slash or empty tuple element). -.. sidebar:: Using :mod:`pyramid_traversalwrapper` +.. sidebar:: For your convenience If you'd rather not manage the ``__name__`` and ``__parent__`` attributes of your resources "by hand", an add-on package named -- cgit v1.2.3 From f5eb753eebbda6fa55ccc5108fcc325931a17f85 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 5 Apr 2013 22:56:48 +0200 Subject: fix some cross-references --- docs/narr/advconfig.rst | 10 +++++----- docs/narr/assets.rst | 2 +- docs/narr/extconfig.rst | 4 ++-- docs/narr/hooks.rst | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/narr/advconfig.rst b/docs/narr/advconfig.rst index 434e2bd6c..1b8e33de3 100644 --- a/docs/narr/advconfig.rst +++ b/docs/narr/advconfig.rst @@ -148,14 +148,14 @@ one: config.add_route(...) Don't call this function directly with ``config`` as an argument. Instead, -use :meth:`pyramid.config.Configuration.include`: +use :meth:`pyramid.config.Configurator.include`: .. code-block:: python :linenos: config.include(add_routes) -Using :meth:`~pyramid.config.Configuration.include` instead of calling the +Using :meth:`~pyramid.config.Configurator.include` instead of calling the function directly provides a modicum of automated conflict resolution, with the configuration statements you define in the calling code overriding those of the included function. See also :ref:`automatic_conflict_resolution` and @@ -333,7 +333,7 @@ his application: config.add_route(...) Rather than calling this function directly with ``config`` as an argument. -Instead, use :meth:`pyramid.config.Configuration.include`: +Instead, use :meth:`pyramid.config.Configurator.include`: .. code-block:: python :linenos: @@ -343,7 +343,7 @@ Instead, use :meth:`pyramid.config.Configuration.include`: Using ``include`` rather than calling the function directly will allow :ref:`automatic_conflict_resolution` to work. -:meth:`~pyramid.config.Configuration.include` can also accept a :term:`module` +:meth:`~pyramid.config.Configurator.include` can also accept a :term:`module` as an argument: .. code-block:: python @@ -357,7 +357,7 @@ For this to work properly, the ``myapp`` module must contain a callable with the special name ``includeme``, which should perform configuration (like the ``add_routes`` callable we showed above as an example). -:meth:`~pyramid.config.Configuration.include` can also accept a :term:`dotted +:meth:`~pyramid.config.Configurator.include` can also accept a :term:`dotted Python name` to a function or a module. .. note: See :ref:`the_include_tag` for a declarative alternative to diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst index 09a2b83f2..26b3e3a92 100644 --- a/docs/narr/assets.rst +++ b/docs/narr/assets.rst @@ -271,7 +271,7 @@ assets which begin with ``mypackage:images`` will be prefixed with # -> http://example.com/images/logo.png Using :meth:`~pyramid.request.Request.static_url` in conjunction with a -:meth:`~pyramid.configuration.Configurator.add_static_view` makes it possible +:meth:`~pyramid.config.Configurator.add_static_view` makes it possible to put static media on a separate webserver during production (if the ``name`` argument to :meth:`~pyramid.config.Configurator.add_static_view` is a URL), while keeping static media package-internal and served by the diff --git a/docs/narr/extconfig.rst b/docs/narr/extconfig.rst index f33326279..659056952 100644 --- a/docs/narr/extconfig.rst +++ b/docs/narr/extconfig.rst @@ -129,8 +129,8 @@ called (either explicitly or as the result of calling :meth:`~pyramid.config.Configurator.make_wsgi_app`), conflicting actions are potentially automatically resolved as per :ref:`automatic_conflict_resolution`. If a conflict cannot be automatically -resolved, a :exc:`ConfigurationConflictError` is raised and application -startup is prevented. +resolved, a :exc:`pyramid.exceptions.ConfigurationConflictError` is raised +and application startup is prevented. In our above example, therefore, if a consumer of our ``add_jammyjam`` directive did this: diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index a3de23baa..77c66b0d2 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -929,7 +929,7 @@ set a *default* view mapper (overriding the superdefault view mapper used by Pyramid itself). A *single* view registration can use a view mapper by passing the mapper as -the ``mapper`` argument to :meth:`~pyramid.config.Configuration.add_view`. +the ``mapper`` argument to :meth:`~pyramid.config.Configurator.add_view`. .. index:: single: configuration decorator -- cgit v1.2.3 From 125ea45ae864a5513e6d83fdded6ceea9516b578 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sat, 6 Apr 2013 07:07:37 +0200 Subject: fix some cross-references Also, pyramid_zcml is cross-referenced, so add it to intersphinx_mapping dict. --- docs/conf.py | 3 +++ docs/designdefense.rst | 4 ++-- docs/glossary.rst | 4 ++-- docs/narr/environment.rst | 2 +- docs/narr/hooks.rst | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 1ddcae08e..67e02471f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -70,6 +70,9 @@ intersphinx_mapping = { 'toolbar': ('http://docs.pylonsproject.org/projects/pyramid_debugtoolbar/en/latest', None), + 'zcml': + ('http://docs.pylonsproject.org/projects/pyramid_zcml/en/latest', + None), } # Add any paths that contain templates here, relative to this directory. diff --git a/docs/designdefense.rst b/docs/designdefense.rst index 7bc37ac06..de607fda3 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -514,7 +514,7 @@ the method is called (if possible) with its argument list filled with values mentioned therein. TurboGears and Pylons 1.X operate similarly. Out of the box, :app:`Pyramid` is configured to have none of these features. -By default, :mod:`pyramid` view callables always accept only ``request`` and +By default, :app:`Pyramid` view callables always accept only ``request`` and no other arguments. The rationale: this argument specification matching done aggressively can be costly, and :app:`Pyramid` has performance as one of its main goals, so we've decided to make people, by default, obtain information @@ -1678,7 +1678,7 @@ was written to address these issues. If it's Zope3-the-web-framework, Pyramid is *definitely* not that. Making use of lots of Zope 3 technologies is territory already staked out by the :term:`Grok` project. Save for the obvious fact that they're both web -frameworks, :mod:`Pyramid` is very, very different than Grok. Grok exposes +frameworks, :app:`Pyramid` is very, very different than Grok. Grok exposes lots of Zope technologies to end users. On the other hand, if you need to understand a Zope-only concept while using Pyramid, then we've failed on some very basic axis. diff --git a/docs/glossary.rst b/docs/glossary.rst index 241f951d6..b6bd35ffe 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -156,9 +156,9 @@ Glossary resource An object representing a node in the :term:`resource tree` of an - application. If :mod:`traversal` is used, a resource is an element in + application. If :term:`traversal` is used, a resource is an element in the resource tree traversed by the system. When traversal is used, a - resource becomes the :term:`context` of a :term:`view`. If :mod:`url + resource becomes the :term:`context` of a :term:`view`. If :term:`url dispatch` is used, a single resource is generated for each request and is used as the context resource of a view. diff --git a/docs/narr/environment.rst b/docs/narr/environment.rst index e059acc4e..f0c0c18fe 100644 --- a/docs/narr/environment.rst +++ b/docs/narr/environment.rst @@ -302,7 +302,7 @@ Ideally, you won't need to use the ``pyramid.tweens`` setting at all. Tweens are generally ordered and included "implicitly" when an add-on package which registers a tween is "included". Packages are included when you name a ``pyramid.includes`` setting in your configuration or when you call -:meth:`pyramid.config.Configuration.include`. +:meth:`pyramid.config.Configurator.include`. Authors of included add-ons provide "implicit" tween configuration ordering hints to Pyramid when their packages are included. However, the implicit diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index 77c66b0d2..1bd294bd1 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -673,7 +673,7 @@ traverser. If you've added a traverser, you can change how :meth:`~pyramid.request.Request.resource_url` generates a URL for a specific type of resource by adding a call to -:meth:`pyramid.config.add_resource_url_adapter`. +:meth:`pyramid.config.Configurator.add_resource_url_adapter`. For example: -- cgit v1.2.3 From d79e9c071505ef0532021308c96ab0ab144f3786 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sat, 6 Apr 2013 07:54:58 +0200 Subject: typo --- docs/designdefense.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/designdefense.rst b/docs/designdefense.rst index 7bc37ac06..488da6b19 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -44,7 +44,7 @@ We were becoming hampered by consequences of its early design mistakes. Zope's lack of documentation was also difficult to work around: it was hard to hire smart people to work on Zope applications, because there was no comprehensive documentation set to point them at which explained "it all" in -one consumble place, and it was too large and self-inconsistent to document +one consumable place, and it was too large and self-inconsistent to document properly. Before :mod:`repoze.bfg` went under development, its authors obviously looked around for other frameworks that fit the bill. But no non-Zope framework did. So we embarked on building :mod:`repoze.bfg`. -- cgit v1.2.3 From 660cb06c0e5ef0be664b6a33fad1db0256d5ec18 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sat, 6 Apr 2013 07:56:08 +0200 Subject: remove repetition; improve readability --- docs/designdefense.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/designdefense.rst b/docs/designdefense.rst index 488da6b19..113ac7ac7 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -38,8 +38,8 @@ forking is also a Zope derivative. Implementations of these features were *required* to allow the :app:`Pyramid` authors to build the bread-and-butter CMS-type systems for customers in the -way they were accustomed to building them. No other system, save for Zope itself, -had such features. And Zope itself was beginning to show signs of its age. +way they were accustomed to. No other system, save for Zope itself, +had such features, and Zope itself was beginning to show signs of its age. We were becoming hampered by consequences of its early design mistakes. Zope's lack of documentation was also difficult to work around: it was hard to hire smart people to work on Zope applications, because there was no -- cgit v1.2.3 From 74a4e377d64e0e44ebea841feed90333c6c7088f Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 6 Apr 2013 01:26:05 -0500 Subject: grammar --- docs/designdefense.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/designdefense.rst b/docs/designdefense.rst index 732a0d357..fdc57e0c1 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -38,7 +38,7 @@ forking is also a Zope derivative. Implementations of these features were *required* to allow the :app:`Pyramid` authors to build the bread-and-butter CMS-type systems for customers in the -way they were accustomed to. No other system, save for Zope itself, +way in which they were accustomed. No other system, save for Zope itself, had such features, and Zope itself was beginning to show signs of its age. We were becoming hampered by consequences of its early design mistakes. Zope's lack of documentation was also difficult to work around: it was hard -- cgit v1.2.3 From 503bbbcffa95694448ea14143de09c3b49662eb4 Mon Sep 17 00:00:00 2001 From: Daniel Holmstrom Date: Sat, 6 Apr 2013 19:41:04 +0200 Subject: Documentation regarding missing Accept header If a request doesn't contain an Accept header routes will match it regardless of thier accept attribute. --- pyramid/config/routes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py index 7a7bbae1a..f495794b4 100644 --- a/pyramid/config/routes.py +++ b/pyramid/config/routes.py @@ -235,7 +235,8 @@ class RoutesConfiguratorMixin(object): wildcard mimetype match token in the form ``text/*`` or a match-all wildcard mimetype match token in the form ``*/*``. If any of the forms matches the ``Accept`` header of the - request, this predicate will be true. If this predicate + request, or if the ``Accept`` header isn't set at all in the + request, this predicate will be true. If this predicate returns ``False``, route matching continues. effective_principals @@ -517,7 +518,7 @@ class RoutesConfiguratorMixin(object): ('traverse', p.TraversePredicate), ): self.add_route_predicate(name, factory) - + def get_routes_mapper(self): """ Return the :term:`routes mapper` object associated with this configurator's :term:`registry`.""" -- cgit v1.2.3 From aaedf52756cf1844deaea432e9c52d740d977789 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 7 Apr 2013 18:55:18 +0200 Subject: fix some cross-references --- docs/api/request.rst | 8 ++++---- pyramid/scaffolds/__init__.py | 4 ++-- pyramid/testing.py | 6 +++--- pyramid/view.py | 2 +- pyramid/wsgi.py | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/api/request.rst b/docs/api/request.rst index 7b843f86e..b1f5918d7 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -190,16 +190,16 @@ :meth:`~pyramid.config.Configurator.set_request_property`) on the request it's passed. - - causes a :class:`~pyramid.event.NewRequest` event to be sent at the + - causes a :class:`~pyramid.events.NewRequest` event to be sent at the beginning of request processing. - - causes a :class:`~pyramid.event.ContextFound` event to be sent + - causes a :class:`~pyramid.events.ContextFound` event to be sent when a context resource is found. - + - Ensures that the user implied by the request passed has the necessary authorization to invoke view callable before calling it. - - causes a :class:`~pyramid.event.NewResponse` event to be sent when + - causes a :class:`~pyramid.events.NewResponse` event to be sent when the Pyramid application returns a response. - Calls any :term:`response callback` functions defined within the diff --git a/pyramid/scaffolds/__init__.py b/pyramid/scaffolds/__init__.py index d8fb9a62f..dc207b540 100644 --- a/pyramid/scaffolds/__init__.py +++ b/pyramid/scaffolds/__init__.py @@ -11,7 +11,7 @@ class PyramidTemplate(Template): templates. """ def pre(self, command, output_dir, vars): - """ Overrides :meth:`pyramid.scaffold.template.Template.pre`, adding + """ Overrides :meth:`pyramid.scaffolds.template.Template.pre`, adding several variables to the default variables list (including ``random_string``, and ``package_logger``). It also prevents common misnamings (such as naming a package "site" or naming a package @@ -30,7 +30,7 @@ class PyramidTemplate(Template): return Template.pre(self, command, output_dir, vars) def post(self, command, output_dir, vars): # pragma: no cover - """ Overrides :meth:`pyramid.scaffold.template.Template.post`, to + """ Overrides :meth:`pyramid.scaffolds.template.Template.post`, to print "Welcome to Pyramid. Sorry for the convenience." after a successful scaffolding rendering.""" self.out('Welcome to Pyramid. Sorry for the convenience.') diff --git a/pyramid/testing.py b/pyramid/testing.py index c4e83714d..b23094267 100644 --- a/pyramid/testing.py +++ b/pyramid/testing.py @@ -137,7 +137,7 @@ class DummyTemplateRenderer(object): def assert_(self, **kw): """ Accept an arbitrary set of assertion key/value pairs. For each assertion key/value pair assert that the renderer - (eg. :func:`pyramid.renderer.render_to_response`) + (eg. :func:`pyramid.renderers.render_to_response`) received the key with a value that equals the asserted value. If the renderer did not receive the key at all, or the value received by the renderer doesn't match the assertion @@ -591,10 +591,10 @@ def testConfig(registry=None, settings=None): """Returns a context manager for test set up. - This context manager calls :func:`pyramid.testing.testSetup` when + This context manager calls :func:`pyramid.testing.setUp` when entering and :func:`pyramid.testing.tearDown` when exiting. - All arguments are passed directly to :func:`pyramid.testing.testSetup`. + All arguments are passed directly to :func:`pyramid.testing.setUp`. If the ZCA is hooked, it will always be un-hooked in tearDown. This context manager allows you to write test code like this: diff --git a/pyramid/view.py b/pyramid/view.py index 76752ce8f..b64db69d2 100644 --- a/pyramid/view.py +++ b/pyramid/view.py @@ -226,7 +226,7 @@ class view_defaults(view_config): """ A class :term:`decorator` which, when applied to a class, will provide defaults for all view configurations that use the class. This decorator accepts all the arguments accepted by - :class:`pyramid.config.view_config`, and each has the same meaning. + :meth:`pyramid.view.view_config`, and each has the same meaning. See :ref:`view_defaults` for more information. """ diff --git a/pyramid/wsgi.py b/pyramid/wsgi.py index 5fa23d554..d176e4ce5 100644 --- a/pyramid/wsgi.py +++ b/pyramid/wsgi.py @@ -25,7 +25,7 @@ def wsgiapp(wrapped): The ``wsgiapp`` decorator will convert the result of the WSGI application to a :term:`Response` and return it to - :app:`Pyramid` as if the WSGI app were a :mod:`pyramid` + :app:`Pyramid` as if the WSGI app were a :app:`Pyramid` view. """ -- cgit v1.2.3 From bf38dbcbf0c73dea2724ada80441b3f709b831bf Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 8 Apr 2013 08:23:47 +0200 Subject: grammar fix --- pyramid/config/adapters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyramid/config/adapters.py b/pyramid/config/adapters.py index 319beab67..fe8e973b1 100644 --- a/pyramid/config/adapters.py +++ b/pyramid/config/adapters.py @@ -33,7 +33,7 @@ class AdaptersConfiguratorMixin(object): Any number of predicate keyword arguments may be passed in ``**predicates``. Each predicate named will narrow the set of - circumstances that the subscriber will be invoked. Each named + circumstances in which the subscriber will be invoked. Each named predicate must have been registered via :meth:`pyramid.config.Configurator.add_subscriber_predicate` before it can be used. See :ref:`subscriber_predicates` for more information. -- cgit v1.2.3 From c35b298f86b2591d7acd44ccb5b1e490269fca74 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Fri, 19 Apr 2013 03:36:43 -0500 Subject: update changes.txt --- CHANGES.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 08e498b7a..9d934794a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -87,6 +87,11 @@ Bug Fixes of invoking the ``permits`` method of the authorization policy. See https://github.com/Pylons/pyramid/issues/954 +- Pyramid failed to install on some systems due to being packaged with + some test files containing higher order characters in their names. These + files have now been removed. See + https://github.com/Pylons/pyramid/issues/981 + 1.4 (2012-12-18) ================ -- cgit v1.2.3 From 439a02a420d9014a56d01f7e08db89ec65d943c5 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 21 Apr 2013 15:27:24 +0200 Subject: docs/narr/hooks.rst: some improvements * consistency fixes: "not found view" --> "Not Found View" * use comparable code for Imperative and Declarative configuration * remove unused import, HTTPForbidden --- docs/narr/hooks.rst | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index 1bd294bd1..37a74b53a 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -14,8 +14,8 @@ in various ways. Changing the Not Found View --------------------------- -When :app:`Pyramid` can't map a URL to view code, it invokes a :term:`not -found view`, which is a :term:`view callable`. The default Not Found View +When :app:`Pyramid` can't map a URL to view code, it invokes a :term:`Not +Found View`, which is a :term:`view callable`. The default Not Found View can be overridden through application configuration. If your application uses :term:`imperative configuration`, you can replace @@ -25,15 +25,17 @@ the Not Found View by using the .. code-block:: python :linenos: - from helloworld.views import notfound - config.add_notfound_view(notfound) + def notfound(request): + return Response('Not Found, dude', status='404 Not Found') -Replace ``helloworld.views.notfound`` with a reference to the :term:`view -callable` you want to use to represent the Not Found View. The :term:`not -found view` callable is a view callable like any other. + def main(globals, **settings): + config = Configurator() + config.add_notfound_view(notfound) + +The :term:`Not Found View` callable is a view callable like any other. If your application instead uses :class:`pyramid.view.view_config` decorators -and a :term:`scan`, you can replace the Not Found view by using the +and a :term:`scan`, you can replace the Not Found View by using the :class:`pyramid.view.notfound_view_config` decorator: .. code-block:: python @@ -46,8 +48,8 @@ and a :term:`scan`, you can replace the Not Found view by using the return Response('Not Found, dude', status='404 Not Found') def main(globals, **settings): - config = Configurator() - config.scan() + config = Configurator() + config.scan() This does exactly what the imperative example above showed. @@ -154,12 +156,12 @@ forbidden view: .. code-block:: python :linenos: - from helloworld.views import forbidden_view - from pyramid.httpexceptions import HTTPForbidden - config.add_forbidden_view(forbidden_view) + def forbidden(request): + return Response('forbidden') -Replace ``helloworld.views.forbidden_view`` with a reference to the Python -:term:`view callable` you want to use to represent the Forbidden view. + def main(globals, **settings): + config = Configurator() + config.add_forbidden_view(forbidden_view) If instead you prefer to use decorators and a :term:`scan`, you can use the :class:`pyramid.view.forbidden_view_config` decorator to mark a view callable -- cgit v1.2.3 From 7a0b5905d65c047ed3ac160f26f6566dfeba8f6a Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 21 Apr 2013 23:07:50 +0300 Subject: remove ambiguity by indicating that the target is API documentation --- docs/narr/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index bfb1287d9..9065488b6 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -125,7 +125,7 @@ method attached to ``MyTest`` will use an isolated registry. The :func:`~pyramid.testing.setUp` and :func:`~pyramid.testing.tearDown` functions accepts various arguments that influence the environment of the -test. See the :ref:`testing_module` chapter for information about the extra +test. See the :ref:`testing_module` API for information about the extra arguments supported by these functions. If you also want to make :func:`~pyramid.threadlocal.get_current_request` return something -- cgit v1.2.3 From 3fc77cfc0283315fe03497e79d07bbdaada6e006 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 21 Apr 2013 23:24:53 +0300 Subject: add a cross-ref... hyperlinks are nice --- docs/narr/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index bfb1287d9..cc042fe39 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -202,7 +202,7 @@ any ``get_current*`` function. Using the ``Configurator`` and ``pyramid.testing`` APIs in Unit Tests --------------------------------------------------------------------- -The ``Configurator`` API and the ``pyramid.testing`` module provide a number +The ``Configurator`` API and the :mod:`pyramid.testing` module provide a number of functions which can be used during unit testing. These functions make :term:`configuration declaration` calls to the current :term:`application registry`, but typically register a "stub" or "dummy" feature in place of the -- cgit v1.2.3 From cd2e8eda277ce100dae7e77a13d4a482b98e26e0 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 22 Apr 2013 02:53:25 +0300 Subject: remove redundant text --- pyramid/request.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyramid/request.py b/pyramid/request.py index f9aa253ac..5bca5b1f0 100644 --- a/pyramid/request.py +++ b/pyramid/request.py @@ -354,8 +354,7 @@ class Request(BaseRequest, DeprecatedRequestMethodsMixin, URLMethodsMixin, """This attribute is actually a "reified" property which returns an instance of the :class:`pyramid.response.Response`. class. The response object returned does not exist until this attribute is - accessed. Once it is accessed, subsequent accesses will return the - same Response object. + accessed. Subsequent accesses will return the same Response object. The ``request.response`` API is used by renderers. A render obtains the response object it will return from a view that uses that renderer -- cgit v1.2.3 From c0d0a36fd4dda100d7b7f3f9e1835c07761d96b8 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 22 Apr 2013 03:18:17 +0300 Subject: no need to reference oneself --- pyramid/testing.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyramid/testing.py b/pyramid/testing.py index b23094267..0c701727b 100644 --- a/pyramid/testing.py +++ b/pyramid/testing.py @@ -508,8 +508,7 @@ def tearDown(unhook_zca=True): pass def cleanUp(*arg, **kw): - """ :func:`pyramid.testing.cleanUp` is an alias for - :func:`pyramid.testing.setUp`. """ + """ An alias for :func:`pyramid.testing.setUp`. """ return setUp(*arg, **kw) class DummyRendererFactory(object): -- cgit v1.2.3 From 8741e9a0e11adbbf58d360f115fb6ad99a76a76e Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 22 Apr 2013 21:08:00 +0200 Subject: no need to link to a chapter that follows immediately --- docs/narr/renderers.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst index b4eb95186..9f7390449 100644 --- a/docs/narr/renderers.rst +++ b/docs/narr/renderers.rst @@ -38,9 +38,7 @@ object from a view that is configured with a renderer, the renderer is bypassed entirely. Various types of renderers exist, including serialization renderers -and renderers which use templating systems. See also -:ref:`views_which_use_a_renderer`. - +and renderers which use templating systems. .. index:: single: renderer -- cgit v1.2.3 From 8104c862d38c4b823fe913b4a7c04161ebba5bbb Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 22 Apr 2013 21:12:00 +0200 Subject: simplify explanation The sentence was simply too long-winded (and not too clear). --- docs/narr/renderers.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst index 9f7390449..9d6509b78 100644 --- a/docs/narr/renderers.rst +++ b/docs/narr/renderers.rst @@ -33,8 +33,7 @@ by the view must be compatible with the particular kind of renderer used, or an error may occur during view invocation. One exception exists: it is *always* OK to return a Response object, even -when a ``renderer`` is configured. If a view callable returns a response -object from a view that is configured with a renderer, the renderer is +when a ``renderer`` is configured. In such cases, the renderer is bypassed entirely. Various types of renderers exist, including serialization renderers -- cgit v1.2.3 From 61b021633fd6d5e9a5773f5409858b3998e48ca0 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 22 Apr 2013 21:18:06 +0200 Subject: grammar --- docs/narr/renderers.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst index b4eb95186..8c88fd055 100644 --- a/docs/narr/renderers.rst +++ b/docs/narr/renderers.rst @@ -51,8 +51,8 @@ and renderers which use templating systems. See also Writing View Callables Which Use a Renderer ------------------------------------------- -As we've seen, view callables needn't always return a Response object. -Instead, they may return an arbitrary Python object, with the expectation +As we've seen, a view callable needn't always return a Response object. +Instead, it may return an arbitrary Python object, with the expectation that a :term:`renderer` will convert that object into a response instance on your behalf. Some renderers use a templating system; other renderers use object serialization techniques. -- cgit v1.2.3 From 6ce39f11b76dc599dfc897eab43bcf236b26c5d5 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 22 Apr 2013 22:43:55 +0300 Subject: remove redundant text Also, this fact has already been explained in the chapter, so mention that. --- docs/narr/renderers.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst index b4eb95186..bcab0e3f4 100644 --- a/docs/narr/renderers.rst +++ b/docs/narr/renderers.rst @@ -80,12 +80,10 @@ response attributes (such as headers and the HTTP status code) by attaching a property to the ``request.response`` attribute. See :ref:`request_response_attr`. -If the :term:`view callable` associated with a :term:`view configuration` -returns a Response object directly, any renderer associated with the view -configuration is ignored, and the response is passed back to :app:`Pyramid` -unchanged. For example, if your view callable returns an instance of the -:class:`pyramid.response.Response` class as a response, no renderer -will be employed. +As already mentioned, if the :term:`view callable` associated with a +:term:`view configuration` returns a Response object (or its instance), +any renderer associated with the view configuration is ignored, +and the response is passed back to :app:`Pyramid` unchanged. For example: .. code-block:: python :linenos: -- cgit v1.2.3 From e8f87a048cf7cc4ac8673dd15d5743afa63e2fbb Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 22 Apr 2013 23:25:12 +0300 Subject: remove redundancy --- docs/narr/renderers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst index b4eb95186..2ebf9b20e 100644 --- a/docs/narr/renderers.rst +++ b/docs/narr/renderers.rst @@ -140,7 +140,7 @@ used in the ``renderer`` attribute of view configurations. ``string``: String Renderer ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The ``string`` renderer is a renderer which renders a view callable result to +The ``string`` renderer renders a view callable result to a string. If a view callable returns a non-Response object, and the ``string`` renderer is associated in that view's configuration, the result will be to run the object through the Python ``str`` function to generate a -- cgit v1.2.3 From cdd8d40dac07d73bf60ebe5d9ddbb2d108d8666e Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 23 Apr 2013 00:47:36 +0300 Subject: add missing comma --- docs/narr/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index 56c62b996..0d0e292bf 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -291,7 +291,7 @@ function is called, :func:`pyramid.security.has_permission` will call the access. We check that the view function raises a :exc:`~pyramid.httpexceptions.HTTPForbidden` error. -The second test method, named ``test_view_fn_allowed`` tests the alternate +The second test method, named ``test_view_fn_allowed``, tests the alternate case, where the authentication policy allows access. Notice that we pass different values to :meth:`~pyramid.config.Configurator.testing_securitypolicy` to obtain this -- cgit v1.2.3 From 727508ba9a19955fb0f65e2dead3b578cee450c3 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 23 Apr 2013 01:24:51 +0300 Subject: replace deprecated method --- docs/narr/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index 56c62b996..89ed038f2 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -373,7 +373,7 @@ after accessing some values that require a fully set up environment. result = my_view(request) self.assertEqual(result.status, '200 OK') body = result.app_iter[0] - self.failUnless('Welcome to' in body) + self.assertTrue('Welcome to' in body) self.assertEqual(len(result.headerlist), 2) self.assertEqual(result.headerlist[0], ('Content-Type', 'text/html; charset=UTF-8')) -- cgit v1.2.3 From 1bf894d55e6a536f31a8c4c2b99c29e96b3bd3a9 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 23 Apr 2013 01:26:58 +0300 Subject: replace deprecated method --- docs/narr/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index 56c62b996..de5a04f56 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -416,7 +416,7 @@ functional testing package written by Ian Bicking. def test_root(self): res = self.testapp.get('/', status=200) - self.failUnless('Pyramid' in res.body) + self.assertTrue('Pyramid' in res.body) When this test is run, each test creates a "real" WSGI application using the ``main`` function in your ``myapp.__init__`` module and uses :term:`WebTest` -- cgit v1.2.3 From e09e08ca4d9c55811053d6a0daba924f2f7c85d5 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 23 Apr 2013 02:09:18 +0300 Subject: grammar --- pyramid/config/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyramid/config/__init__.py b/pyramid/config/__init__.py index 4f7899b54..5bb9987af 100644 --- a/pyramid/config/__init__.py +++ b/pyramid/config/__init__.py @@ -642,7 +642,7 @@ class Configurator( argument named ``config``, which will be an instance of a :term:`Configurator`. However, be warned that it will not be the same configurator instance on which you call this method. The - code which runs as the result of calling the callable should invoke + code which runs as a result of calling the callable should invoke methods on the configurator passed to it which add configuration state. The return value of a callable will be ignored. -- cgit v1.2.3