diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-10-10 02:46:33 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-10-10 02:46:33 +0000 |
| commit | dc998c7f89f0e30f2ce29746e0e088e2448c38e7 (patch) | |
| tree | d45d62ff9790bb7f142b88149e82460e12b2a7c8 /docs/tutorials | |
| parent | 9340fb3c8ee7ed1a197c0088b176fc16101240e4 (diff) | |
| download | pyramid-dc998c7f89f0e30f2ce29746e0e088e2448c38e7.tar.gz pyramid-dc998c7f89f0e30f2ce29746e0e088e2448c38e7.tar.bz2 pyramid-dc998c7f89f0e30f2ce29746e0e088e2448c38e7.zip | |
More renderer conversions.
Diffstat (limited to 'docs/tutorials')
4 files changed, 11 insertions, 5 deletions
diff --git a/docs/tutorials/bfgwiki/definingviews.rst b/docs/tutorials/bfgwiki/definingviews.rst index 699a86d66..a3b7ccee4 100644 --- a/docs/tutorials/bfgwiki/definingviews.rst +++ b/docs/tutorials/bfgwiki/definingviews.rst @@ -140,12 +140,12 @@ it also acts as the handler for the form it renders. The ``context`` of the ``edit_page`` view will *always* be a Page object (never a Wiki object). -If the view rendering is *not* a result of a form submission (if the +If the view execution is *not* a result of a form submission (if the expression ``'form.submitted' in request.params`` is False), the view simply renders the edit form, passing the request, the page object, and a save_url which will be used as the action of the generated form. -If the view rendering *is* a result of a form submission (if the +If the view execution *is* a result of a form submission (if the expression ``'form.submitted' in request.params`` is True), the view grabs the ``body`` element of the request parameter and sets it as the ``data`` attribute of the page context. It then redirects to the @@ -188,6 +188,15 @@ the below: :linenos: :language: xml +.. note:: The names available for our use in a template are always + those that are present in the dictionary returned by the view + callable. But our templates make use of a ``request`` object that + none of our tutorial views return in their dictionary. This value + appears as if "by magic". However, ``request`` is one of several + names that are available "by default" in a template when a template + renderer is used. See :ref:`chameleon_template_renderers` for more + information about other names that are available by default in a + template when a Chameleon template is used as a renderer. The ``edit.pt`` Template ------------------------ diff --git a/docs/tutorials/bfgwiki/src/authorization/tutorial/tests.py b/docs/tutorials/bfgwiki/src/authorization/tutorial/tests.py index cd29d6ff4..a1cb42425 100644 --- a/docs/tutorials/bfgwiki/src/authorization/tutorial/tests.py +++ b/docs/tutorials/bfgwiki/src/authorization/tutorial/tests.py @@ -142,7 +142,6 @@ class EditPageTests(unittest.TestCase): context = testing.DummyModel() request = testing.DummyRequest({'form.submitted':True, 'body':'Hello yo!'}) - renderer = testing.registerDummyRenderer('templates/edit.pt') response = self._callFUT(context, request) self.assertEqual(response.location, 'http://example.com/') self.assertEqual(context.data, 'Hello yo!') diff --git a/docs/tutorials/bfgwiki/src/viewdecorators/tutorial/tests.py b/docs/tutorials/bfgwiki/src/viewdecorators/tutorial/tests.py index cd29d6ff4..a1cb42425 100644 --- a/docs/tutorials/bfgwiki/src/viewdecorators/tutorial/tests.py +++ b/docs/tutorials/bfgwiki/src/viewdecorators/tutorial/tests.py @@ -142,7 +142,6 @@ class EditPageTests(unittest.TestCase): context = testing.DummyModel() request = testing.DummyRequest({'form.submitted':True, 'body':'Hello yo!'}) - renderer = testing.registerDummyRenderer('templates/edit.pt') response = self._callFUT(context, request) self.assertEqual(response.location, 'http://example.com/') self.assertEqual(context.data, 'Hello yo!') diff --git a/docs/tutorials/bfgwiki/src/views/tutorial/tests.py b/docs/tutorials/bfgwiki/src/views/tutorial/tests.py index 888618842..e25617b7a 100644 --- a/docs/tutorials/bfgwiki/src/views/tutorial/tests.py +++ b/docs/tutorials/bfgwiki/src/views/tutorial/tests.py @@ -142,7 +142,6 @@ class EditPageTests(unittest.TestCase): context = testing.DummyModel() request = testing.DummyRequest({'form.submitted':True, 'body':'Hello yo!'}) - renderer = testing.registerDummyRenderer('templates/edit.pt') response = self._callFUT(context, request) self.assertEqual(response.location, 'http://example.com/') self.assertEqual(context.data, 'Hello yo!') |
