Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

55 lines (39 sloc) 1.687 kB

This model gives access to the request variables from within a template.

Sometimes you need direct access to request variables in your template. The m_req model is meant for this. It exposes some values from the Webmachine request record.

Fetching a single value

You can fetch individual values by key, for example:

{{|escape }}

Viewing all request variables

Use the :ref:`tag-print` tag to get a complete overview of all request variables:

{% print m.req|make_list %}

This will show something like:

         {"accept-encoding","gzip, deflate"},
         {"cookie","z_sid=1RrDIvFVsoyLgtSU62mN; z_pid=HRrAaiPI08Il4Nu4wST1"},
          "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16"}]}]

Please note that all values are raw and not escaped, take care to escape the values before you use them in your templates, using the :ref:`filter-escape` filter.

The :ref:`filter-make_list` filter is used to force the evaluation of the model; otherwise it would just print {m,req,undefined}.

Jump to Line
Something went wrong with that request. Please try again.