- Allow ``decorator`` and ``mapper`` arguments to view ZCML directive.
- Document ``decorator`` and ``mapper`` arguments in various places.
| | |
| | | - Re-make testing.setUp() and testing.tearDown() the canonical APIs for test |
| | | configuration. |
| | | |
| | | - Document ``decorator=`` and ``view_mapper`` parameters to add_view and |
| | | ``@view_config``. |
| | | |
| | | - Allow ``decorator=`` and ``view_mapper=`` to be passed via ZCML. |
| | | |
| | | - Document ``Configurator.set_view_mapper``. |
| | | |
| | | - Document ``__view_mapper__`` attribute for view callable view mapper |
| | | preference. |
| | | - Document ``__view_mapper__`` attribute and ``mapper`` argument to view |
| | | configuration for view callable view mapper preference. |
| | | |
| | | - ZCML directive for view mapper (or just use "utility", but it's not eager). |
| | | |
| | |
| | | |
| | | If ``wrapper`` is not supplied, no wrapper view is used. |
| | | |
| | | ``decorator`` |
| | | A :term:`dotted Python name` to function (or the function itself) which |
| | | will be used to decorate the registered :term:`view callable`. The |
| | | decorator function will be called with the view callable as a single |
| | | argument. The view callable it is passed will accept ``(context, |
| | | request)``. The decorator must return a replacement view callable which |
| | | also accepts ``(context, request)``. |
| | | |
| | | ``mapper`` |
| | | A Python object or :term:`dotted Python name` which refers to a :term:`view |
| | | mapper`, or ``None``. By default it is ``None``, which indicates that the |
| | | view should use the default view mapper. This plug-point is useful for |
| | | Pyramid extension developers, but it's not very useful for 'civilians' who |
| | | are just developing stock Pyramid applications. Pay no attention to the man |
| | | behind the curtain. |
| | | |
| | | Predicate Arguments |
| | | +++++++++++++++++++ |
| | | |
| | |
| | | associated view callable will be considered viable for a given |
| | | request. |
| | | |
| | | ``decorator`` |
| | | A :term:`dotted Python name` to a function that will be used to decorate |
| | | the registered :term:`view callable`. The decorator function will be |
| | | called with the view callable as a single argument. The view callable it |
| | | is passed will accept ``(context, request)``. The decorator must return a |
| | | replacement view callable which also accepts ``(context, request)``. |
| | | |
| | | ``mapper`` |
| | | A :term:`dotted Python name` which refers to a :term:`view mapper`, or |
| | | ``None``. By default it is ``None``, which indicates that the view should |
| | | use the default view mapper. This plug-point is useful for Pyramid |
| | | extension developers, but it's not very useful for 'civilians' who are just |
| | | developing stock Pyramid applications. |
| | | |
| | | Examples |
| | | ~~~~~~~~ |
| | | |
| | |
| | | |
| | | decorator |
| | | |
| | | A function which will be used to decorate the registered |
| | | :term:`view callable`. The decorator function will be called with |
| | | the view callable as a single argument. The view callable it is |
| | | passed will accept ``(context, request)`. The decorator must |
| | | return a replacement view callable which also accepts ``(context, |
| | | A :term:`dotted Python name` to function (or the function itself) |
| | | which will be used to decorate the registered :term:`view |
| | | callable`. The decorator function will be called with the view |
| | | callable as a single argument. The view callable it is passed will |
| | | accept ``(context, request)``. The decorator must return a |
| | | replacement view callable which also accepts ``(context, |
| | | request)``. |
| | | |
| | | mapper |
| | | |
| | | A Python object or :term:`dotted Python name` which refers to a |
| | | :term:`view mapper`, or ``None``. By default it is ``None``, which |
| | | indicates that the view should use the default view mapper. This |
| | | plug-point is useful for Pyramid extension developers, but it's not |
| | | very useful for 'civilians' who are just developing stock Pyramid |
| | | applications. Pay no attention to the man behind the curtain. |
| | | |
| | | Predicate Arguments |
| | | |
| | |
| | | ``True``, the associated view callable will be considered |
| | | viable for a given request. |
| | | |
| | | mapper |
| | | |
| | | A Python object or :term:`dotted Python name` which refers to a |
| | | :term:`view mapper`, or ``None``. By default it is ``None``, which |
| | | indicates that the view should use the default view mapper. This |
| | | plug-point is useful for Pyramid extension developers, but it's not |
| | | very useful for 'civilians' who are just developing stock Pyramid |
| | | applications. Pay no attention to the man behind the curtain. |
| | | |
| | | """ |
| | | view = self.maybe_dotted(view) |
| | | context = self.maybe_dotted(context) |
| | | for_ = self.maybe_dotted(for_) |
| | | containment = self.maybe_dotted(containment) |
| | | mapper = self.maybe_dotted(mapper) |
| | | decorator = self.maybe_dotted(decorator) |
| | | |
| | | if not view: |
| | | if renderer: |
| | |
| | | ``False``). The view will only be invoked if all custom |
| | | predicates return ``True``. |
| | | |
| | | See the :meth:`pyramid.config.Configurator.add_view`` method for |
| | | descriptions of the ``decorator`` and ``mapper`` arguments. |
| | | |
| | | Any individual or all parameters can be omitted. The simplest |
| | | :class:`pyramid.view.view_config` declaration is:: |
| | | |
| | |
| | | description=(u'Accepts a regular expression.'), |
| | | required = False) |
| | | |
| | | decorator = GlobalObject( |
| | | title = u'View decorator', |
| | | required = False) |
| | | |
| | | mapper = GlobalObject( |
| | | title = u'View mapper', |
| | | required = False) |
| | | |
| | | custom_predicates = Tokens( |
| | | title=u"One or more custom dotted names to custom predicate callables", |
| | | description=(u"A list of dotted name references to callables that " |
| | |
| | | header=None, |
| | | path_info=None, |
| | | traverse=None, |
| | | decorator=None, |
| | | mapper=None, |
| | | custom_predicates=(), |
| | | context=None, |
| | | cacheable=True, # not used, here for b/w compat < 0.8 |
| | |
| | | request_method=request_method, request_param=request_param, |
| | | containment=containment, attr=attr, renderer=renderer, |
| | | wrapper=wrapper, xhr=xhr, accept=accept, header=header, |
| | | path_info=path_info, custom_predicates=custom_predicates) |
| | | path_info=path_info, custom_predicates=custom_predicates, |
| | | decorator=decorator, mapper=mapper) |
| | | |
| | | _view = view # for directives that take a view arg |
| | | |