diff options
| author | Tres Seaver <tseaver@palladion.com> | 2014-02-16 23:00:38 -0500 |
|---|---|---|
| committer | Tres Seaver <tseaver@palladion.com> | 2014-02-16 23:00:38 -0500 |
| commit | 3c87ad81b0e846e7d61f86f8a5a6aff6ec3a2b9e (patch) | |
| tree | 7d06cf7904f9fbd1384c31825bd42ee8cdfa6bfe /docs | |
| parent | 111aef8a7d0e000d6ff65cc15138c2d376b1efc4 (diff) | |
| download | pyramid-3c87ad81b0e846e7d61f86f8a5a6aff6ec3a2b9e.tar.gz pyramid-3c87ad81b0e846e7d61f86f8a5a6aff6ec3a2b9e.tar.bz2 pyramid-3c87ad81b0e846e7d61f86f8a5a6aff6ec3a2b9e.zip | |
Clarify.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/quick_tutorial/more_view_classes.rst | 11 | ||||
| -rw-r--r-- | docs/quick_tutorial/more_view_classes/tutorial/views.py | 4 |
2 files changed, 7 insertions, 8 deletions
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 <class_as_view>` makes sense: +together as a :ref:`view class <class_as_view>` makes sense: - Group views @@ -30,9 +29,9 @@ together as a - Share some state and helpers -Pyramid views have -:ref:`view predicates <view_configuration_parameters>` that -help determine which view is matched to a request. These predicates +Pyramid views have :ref:`view predicates <view_configuration_parameters>` +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'} |
