diff options
| author | cewing <cris@crisewing.com> | 2016-06-03 17:43:39 -0700 |
|---|---|---|
| committer | cewing <cris@crisewing.com> | 2016-06-09 11:20:55 -0700 |
| commit | 42089ef5acc065dbb1fe826855936a415162b42b (patch) | |
| tree | 49f9fd4ae55d8e231983babd17d5d8e5d9f75d44 | |
| parent | f9822db7231bc4e52cadc467d60ea328def08d5b (diff) | |
| download | pyramid-42089ef5acc065dbb1fe826855936a415162b42b.tar.gz pyramid-42089ef5acc065dbb1fe826855936a415162b42b.tar.bz2 pyramid-42089ef5acc065dbb1fe826855936a415162b42b.zip | |
re-write the views section
| -rw-r--r-- | docs/narr/introduction.rst | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst index 2782267ae..2ede8328d 100644 --- a/docs/narr/introduction.rst +++ b/docs/narr/introduction.rst @@ -187,19 +187,15 @@ framework itself. You will find them to be fully tested and well documented. Examples: https://trypyramid.com/resources-extending-pyramid.html -Class-based and function-based views -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Pyramid has a structured, unified concept of a :term:`view callable`. View -callables can be functions, methods of classes, or even instances. When you -add a new view callable, you can choose to make it a function or a method of a -class. In either case Pyramid treats it largely the same way. You can change -your mind later and move code between methods of classes and functions. A -collection of similar view callables can be attached to a single class as -methods, if that floats your boat, and they can share initialization code as -necessary. All kinds of views are easy to understand and use, and operate -similarly. There is no phony distinction between them. They can be used for -the same purposes. +Write your views +~~~~~~~~~~~~~~~~ + +A fundamental task for any framework is to map URLs to code. In Pyramid, that +code is called a :term:`view callable`. View callables can be functions, class +methods or even callable class instances. You are free to choose the approach +that best fits your use case. Regardless of your choice, Pyramid treats them +the same. You can change your mind at any time without any penalty. There are +no artificial distinctions between the various approaches. Here's a view callable defined as a function: |
