From eaaa8855d88eedb2ad4fef435e7473022504485e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 25 Oct 2010 21:41:46 -0400 Subject: convert more docs from bfg to pyramid --- docs/narr/events.rst | 2 +- docs/narr/templates.rst | 20 +++++++++----------- docs/narr/unittesting.rst | 8 ++++---- 3 files changed, 14 insertions(+), 16 deletions(-) (limited to 'docs/narr') diff --git a/docs/narr/events.rst b/docs/narr/events.rst index 99ea600fa..91eb27616 100644 --- a/docs/narr/events.rst +++ b/docs/narr/events.rst @@ -33,7 +33,7 @@ when it's called. The mere existence of a subscriber function, however, is not sufficient to arrange for it to be called. To arrange for the subscriber to be called, you'll need to use the -:meth:`pyramid.configurator.Configurator.add_subscriber` method to +:meth:`pyramid.configuration.Configurator.add_subscriber` method to register the subscriber imperatively, or via a decorator, or you'll need to use ZCML for the same purpose: diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst index f3536363c..0650480af 100644 --- a/docs/narr/templates.rst +++ b/docs/narr/templates.rst @@ -51,16 +51,14 @@ within the body of a view callable like so: .. warning:: Earlier iterations of this documentation (pre-version-1.3) encouraged the application developer to use ZPT-specific APIs such as - :func:`pyramid.chameleon_zpt.render_template_to_response`, - :func:`pyramid.chameleon_zpt.render_template_to_iterable`, and - :func:`pyramid.chameleon_zpt.render_template` to render - templates directly. This style of rendering still works, but at - least for purposes of this documentation, those functions are - deprecated. Application developers are encouraged instead to use - the functions available in the :mod:`pyramid.renderers` module - to perform rendering tasks. This set of functions works to render - templates for all renderer extensions registered with - :mod:`pyramid`. + :func:`pyramid.chameleon_zpt.render_template_to_response` and + :func:`pyramid.chameleon_zpt.render_template` to render templates + directly. This style of rendering still works, but at least for + purposes of this documentation, those functions are deprecated. + Application developers are encouraged instead to use the functions + available in the :mod:`pyramid.renderers` module to perform + rendering tasks. This set of functions works to render templates + for all renderer extensions registered with :mod:`pyramid`. The ``sample_view`` :term:`view callable` above returns a :term:`response` object which contains the body of the @@ -116,7 +114,7 @@ function. Every view must return a :term:`response` object (except for views which use a :term:`renderer` named via view configuration, which we'll -see shortly). The :func:`pyramid.renders.render_to_response` +see shortly). The :func:`pyramid.renderers.render_to_response` function is a shortcut function that actually returns a response object. diff --git a/docs/narr/unittesting.rst b/docs/narr/unittesting.rst index d6f854187..85f74ec0a 100644 --- a/docs/narr/unittesting.rst +++ b/docs/narr/unittesting.rst @@ -226,14 +226,14 @@ used the testing API. def test_view_fn_not_submitted(self): from my.package import view_fn - renderer = self.config.testing_add_template('templates/show.pt') + renderer = self.config.testing_add_renderer('templates/show.pt') request = testing.DummyRequest() response = view_fn(request) renderer.assert_(say='Hello') def test_view_fn_submitted(self): from my.package import view_fn - renderer = self.config.testing_add_template( + renderer = self.config.testing_add_renderer( 'templates/submitted.pt') request = testing.DummyRequest() request.params['say'] = 'Yo' @@ -249,7 +249,7 @@ The first test method, ``test_view_fn_not_submitted`` tests the ``view_fn`` function in the case that no "form" values (represented by request.params) have been submitted. Its first line registers a "dummy template renderer" named ``templates/show.pt`` via the -:meth:`pyramid.configuration.Configurator.testing_add_template` +:meth:`pyramid.configuration.Configurator.testing_add_renderer` method; this method returns a :class:`pyramid.testing.DummyTemplateRenderer` instance which we hang on to for later. @@ -367,7 +367,7 @@ environment. str(len(body)))) Unless you cannot avoid it, you should prefer writing unit tests that -use the :class:`pyramid.configuration,Configurator` API to set up +use the :class:`pyramid.configuration.Configurator` API to set up the right "mock" registrations rather than creating an integration test. Unit tests will run faster (because they do less for each test) and the result of a unit test is usually easier to make assertions -- cgit v1.2.3