From 3c87ad81b0e846e7d61f86f8a5a6aff6ec3a2b9e Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Sun, 16 Feb 2014 23:00:38 -0500 Subject: Clarify. --- docs/quick_tutorial/more_view_classes.rst | 11 +++++------ docs/quick_tutorial/more_view_classes/tutorial/views.py | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'docs/quick_tutorial') diff --git a/docs/quick_tutorial/more_view_classes.rst b/docs/quick_tutorial/more_view_classes.rst index 21b353b7c..1e5603554 100644 --- a/docs/quick_tutorial/more_view_classes.rst +++ b/docs/quick_tutorial/more_view_classes.rst @@ -18,11 +18,10 @@ or a Python class. In this last case, methods on the class can be decorated with ``@view_config`` to register the class methods with the :term:`configurator` as a view. -So far our views have been simple, free-standing functions. Many times +At first, our views were simple, free-standing functions. Many times your views are related: different ways to look at or work on the same data or a REST API that handles multiple operations. Grouping these -together as a -:ref:`view class ` makes sense: +together as a :ref:`view class ` makes sense: - Group views @@ -30,9 +29,9 @@ together as a - Share some state and helpers -Pyramid views have -:ref:`view predicates ` that -help determine which view is matched to a request. These predicates +Pyramid views have :ref:`view predicates ` +that determine which view is matched to a request, based on factors +such as the request method, the form parameters, etc. These predicates provide many axes of flexibility. The following shows a simple example with four operations operations: diff --git a/docs/quick_tutorial/more_view_classes/tutorial/views.py b/docs/quick_tutorial/more_view_classes/tutorial/views.py index fdba04ba8..635de0520 100644 --- a/docs/quick_tutorial/more_view_classes/tutorial/views.py +++ b/docs/quick_tutorial/more_view_classes/tutorial/views.py @@ -20,7 +20,6 @@ class TutorialViews: def home(self): return {'page_title': 'Home View'} - # Retrieving /howdy/first/last the first time @view_config(renderer='hello.pt') def hello(self): @@ -33,7 +32,8 @@ class TutorialViews: return {'page_title': 'Edit View', 'new_name': new_name} # Posting to /home via the "Delete" submit button - @view_config(request_param='form.delete', renderer='delete.pt') + @view_config(request_method='POST', request_param='form.delete', + renderer='delete.pt') def delete(self): print ('Deleted') return {'page_title': 'Delete View'} -- cgit v1.2.3