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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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 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 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') 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 -- 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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(-) (limited to 'docs') 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 613a7e5972ac15c0c296307de47944bfb07969c0 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 23 Apr 2013 09:35:48 +0300 Subject: add a note about missing code --- docs/narr/testing.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs') diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index ec5952a7c..88d6904c7 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -222,6 +222,12 @@ function. raise HTTPForbidden return {'greeting':'hello'} +.. note:: + + This code implies that you have defined a renderer imperatively in a + relevant :class:`pyramid.config.Configurator` instance, + otherwise it would fail when run normally. + Without doing anything special during a unit test, the call to :func:`~pyramid.security.has_permission` in this view function will always return a ``True`` value. When a :app:`Pyramid` application starts normally, -- cgit v1.2.3 From 44883effdac471edaf893566f3aac83450d49159 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 23 Apr 2013 23:35:11 +0200 Subject: replace deprecated method --- docs/tutorials/wiki/src/models/tutorial/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/tutorials/wiki/src/models/tutorial/tests.py b/docs/tutorials/wiki/src/models/tutorial/tests.py index 9fd13a18d..0c5f99575 100644 --- a/docs/tutorials/wiki/src/models/tutorial/tests.py +++ b/docs/tutorials/wiki/src/models/tutorial/tests.py @@ -45,7 +45,7 @@ class AppmakerTests(unittest.TestCase): app_root = object() root = {'app_root': app_root} self._callFUT(root) - self.failUnless(root['app_root'] is app_root) + self.assertTrue(root['app_root'] is app_root) class ViewTests(unittest.TestCase): def setUp(self): -- cgit v1.2.3 From 452005b6a96b6096b65ce63cb91574197cc9718c Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 28 Apr 2013 19:37:48 +0200 Subject: use a cross-ref instead of a raw link --- docs/glossary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/glossary.rst b/docs/glossary.rst index b6bd35ffe..abc37c7f8 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -698,7 +698,7 @@ Glossary :app:`Pyramid` runs on GAE. Venusian - `Venusian `_ is a library which + :ref:`Venusian` is a library which allows framework authors to defer decorator actions. Instead of taking actions when a function (or class) decorator is executed at import time, the action usually taken by the decorator is -- cgit v1.2.3 From 92deb60fdabc7092e21a0a1c48bf1b10788c7346 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Fri, 3 May 2013 20:08:14 -0700 Subject: docs should be risky in master! --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index 67e02471f..84b01a791 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -170,7 +170,7 @@ html_theme_path = ['_themes'] html_theme = 'pyramid' html_theme_options = dict( github_url='https://github.com/Pylons/pyramid', -# in_progress='true', + in_progress='true', ) # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths -- cgit v1.2.3