Use req instead of r for #413. It's more likely that somebody is already passing something named r, and a template may depend on its existence or nonexistence to conditionalize rendering a bit of html.
| | |
| | | more information. This is not a new feature, it just provides an API for |
| | | adding a traverser without needing to use the ZCA API. |
| | | |
| | | - The system value ``r`` is now supplied to renderers as an alias for |
| | | - The system value ``req`` is now supplied to renderers as an alias for |
| | | ``request``. This means that you can now, for example, in a template, do |
| | | ``r.route_url(...)`` instead of ``request.route_url(...)``. This is purely |
| | | a change to reduce the amount of typing required to reference request |
| | | methods from within templates. |
| | | ``req.route_url(...)`` instead of ``request.route_url(...)``. This is |
| | | purely a change to reduce the amount of typing required to use request |
| | | methods and attributes from within templates. The value ``request`` is |
| | | still available too, this is just an alternative. |
| | | |
| | | Documentation |
| | | ------------- |
| | |
| | | of the directive), ``renderer_info`` (an object containing renderer-related |
| | | information), ``context`` (the context resource of the view used to render |
| | | the template), and ``request`` (the request passed to the view used to render |
| | | the template). ``request`` is also available as ``r`` in Pyramid 1.3+. |
| | | the template). ``request`` is also available as ``req`` in Pyramid 1.3+. |
| | | |
| | | Here's an example view configuration which uses a Chameleon ZPT renderer: |
| | | |
| | |
| | | something like "AttributeError: 'NoneType' object has no attribute |
| | | 'rfind'". |
| | | |
| | | - The system value ``r`` is now supplied to renderers as an alias for |
| | | - The system value ``req`` is now supplied to renderers as an alias for |
| | | ``request``. This means that you can now, for example, in a template, do |
| | | ``r.route_url(...)`` instead of ``request.route_url(...)``. |
| | | ``req.route_url(...)`` instead of ``request.route_url(...)``. This is |
| | | purely a change to reduce the amount of typing required to use request |
| | | methods and attributes from within templates. The value ``request`` is |
| | | still available too, this is just an alternative. |
| | | |
| | | Backwards Incompatibilities |
| | | --------------------------- |
| | |
| | | 'renderer_info':self, |
| | | 'context':context, |
| | | 'request':request, |
| | | 'r':request, |
| | | 'req':request, |
| | | } |
| | | return self.render_to_response(response, system, request=request) |
| | | |
| | |
| | | 'renderer_info':self, |
| | | 'context':getattr(request, 'context', None), |
| | | 'request':request, |
| | | 'r':request, |
| | | 'req':request, |
| | | } |
| | | |
| | | system_values = BeforeRender(system_values, value) |
| | |
| | | 'request': request, |
| | | 'context': 'context', |
| | | 'view': 'view', |
| | | 'r': request,} |
| | | 'req': request,} |
| | | ) |
| | | |
| | | def test_render_explicit_registry(self): |
| | |
| | | 'renderer_name':'loo.foo', |
| | | 'view':None, |
| | | 'renderer_info':helper, |
| | | 'r':request, |
| | | 'req':request, |
| | | } |
| | | self.assertEqual(result[0], 'values') |
| | | self.assertEqual(result[1], system) |