Ben Bangert avatar Ben Bangert committed 884660d

Adding basic account login

Comments (0)

Files changed (19)

-Content-Type: multipart/mixed; boundary="===============1582387333=="
-MIME-Version: 1.0
-
---===============1582387333==
+Content-Type: multipart/mixed; boundary="===============1827181674=="
+MIME-Version: 1.0
+
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 011f372b2fd99a18a2bece4e190c538f
-ETag: 3448543274
+ETag: 2658205593
 
 {
   "_id": "011f372b2fd99a18a2bece4e190c538f", 
-  "_rev": "3448543274", 
+  "_rev": "2658205593", 
   "body": "<div class=\"section\" id=\"routes-route-and-mapper-core-classes\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">routes</span></tt> &#8211; Route and Mapper core classes<a class=\"headerlink\" href=\"#routes-route-and-mapper-core-classes\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"module-routes.base\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">routes.base</span></tt><a class=\"headerlink\" href=\"#module-routes.base\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Route and Mapper core classes</p>\n<dl class=\"class\">\n<dt id=\"routes.base.Route\">\n<!--[routes.base.Route]-->class <tt class=\"descclassname\">routes.base.</tt><tt class=\"descname\">Route</tt><big>(</big><em>routepath</em>, <em>**kargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>The Route object holds a route recognition and generation\nroutine.</p>\n<p>See Route.__init__ docs for usage.</p>\n<dl class=\"method\">\n<dt id=\"routes.base.Route.buildfullreg\">\n<!--[routes.base.Route.buildfullreg]--><tt class=\"descname\">buildfullreg</tt><big>(</big><em>clist</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.buildfullreg\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Build the regexp by iterating through the routelist and\nreplacing dicts with the appropriate regexp match</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Route.buildnextreg\">\n<!--[routes.base.Route.buildnextreg]--><tt class=\"descname\">buildnextreg</tt><big>(</big><em>path</em>, <em>clist</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.buildnextreg\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Recursively build our regexp given a path, and a controller\nlist.</p>\n<p>Returns the regular expression string, and two booleans that\ncan be ignored as they&#8217;re only used internally by buildnextreg.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Route.generate\">\n<!--[routes.base.Route.generate]--><tt class=\"descname\">generate</tt><big>(</big><em>_ignore_req_list=False</em>, <em>_append_slash=False</em>, <em>**kargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.generate\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Generate a URL from ourself given a set of keyword arguments</p>\n<p>Toss an exception if this\nset of keywords would cause a gap in the url.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Route.generate_minimized\">\n<!--[routes.base.Route.generate_minimized]--><tt class=\"descname\">generate_minimized</tt><big>(</big><em>kargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.generate_minimized\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Generate a minimized version of the URL</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Route.generate_non_minimized\">\n<!--[routes.base.Route.generate_non_minimized]--><tt class=\"descname\">generate_non_minimized</tt><big>(</big><em>kargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.generate_non_minimized\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Generate a non-minimal version of the URL</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Route.make_full_route\">\n<!--[routes.base.Route.make_full_route]--><tt class=\"descname\">make_full_route</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.make_full_route\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Make a full routelist string for use with non-minimized\ngeneration</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Route.make_unicode\">\n<!--[routes.base.Route.make_unicode]--><tt class=\"descname\">make_unicode</tt><big>(</big><em>s</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.make_unicode\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Transform the given argument into a unicode string.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Route.makeregexp\">\n<!--[routes.base.Route.makeregexp]--><tt class=\"descname\">makeregexp</tt><big>(</big><em>clist</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.makeregexp\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a regular expression for matching purposes</p>\n<p>Note: This MUST be called before match can function properly.</p>\n<p>clist should be a list of valid controller strings that can be \nmatched, for this reason makeregexp should be called by the web\nframework after it knows all available controllers that can be\nutilized.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Route.match\">\n<!--[routes.base.Route.match]--><tt class=\"descname\">match</tt><big>(</big><em>url</em>, <em>environ=None</em>, <em>sub_domains=False</em>, <em>sub_domains_ignore=None</em>, <em>domain_match=''</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Route.match\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Match a url to our regexp.</p>\n<p>While the regexp might match, this operation isn&#8217;t\nguaranteed as there&#8217;s other factors that can cause a match to\nfail even though the regexp succeeds (Default that was relied\non wasn&#8217;t given, requirement regexp doesn&#8217;t pass, etc.).</p>\n<p>Therefore the calling function shouldn&#8217;t assume this will\nreturn a valid dict, the other possible return is False if a\nmatch doesn&#8217;t work out.</p>\n</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"routes.base.Mapper\">\n<!--[routes.base.Mapper]-->class <tt class=\"descclassname\">routes.base.</tt><tt class=\"descname\">Mapper</tt><big>(</big><em>controller_scan=&lt;function controller_scan at 0x1ee6530&gt;</em>, <em>directory=None</em>, <em>always_scan=False</em>, <em>register=True</em>, <em>explicit=False</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Mapper\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Mapper handles URL generation and URL recognition in a web\napplication.</p>\n<p>Mapper is built handling dictionary&#8217;s. It is assumed that the web\napplication will handle the dictionary returned by URL recognition\nto dispatch appropriately.</p>\n<p>URL generation is done by passing keyword parameters into the\ngenerate function, a URL is then returned.</p>\n<dl class=\"method\">\n<dt id=\"routes.base.Mapper.connect\">\n<!--[routes.base.Mapper.connect]--><tt class=\"descname\">connect</tt><big>(</big><em>*args</em>, <em>**kargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Mapper.connect\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create and connect a new Route to the Mapper.</p>\n<p>Usage:</p>\n<div class=\"highlight\"><pre><span class=\"n\">m</span> <span class=\"o\">=</span> <span class=\"n\">Mapper</span><span class=\"p\">()</span>\n<span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">connect</span><span class=\"p\">(</span><span class=\"s\">&#39;:controller/:action/:id&#39;</span><span class=\"p\">)</span>\n<span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">connect</span><span class=\"p\">(</span><span class=\"s\">&#39;date/:year/:month/:day&#39;</span><span class=\"p\">,</span> <span class=\"n\">controller</span><span class=\"o\">=</span><span class=\"s\">&quot;blog&quot;</span><span class=\"p\">,</span> <span class=\"n\">action</span><span class=\"o\">=</span><span class=\"s\">&quot;view&quot;</span><span class=\"p\">)</span>\n<span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">connect</span><span class=\"p\">(</span><span class=\"s\">&#39;archives/:page&#39;</span><span class=\"p\">,</span> <span class=\"n\">controller</span><span class=\"o\">=</span><span class=\"s\">&quot;blog&quot;</span><span class=\"p\">,</span> <span class=\"n\">action</span><span class=\"o\">=</span><span class=\"s\">&quot;by_page&quot;</span><span class=\"p\">,</span>\n<span class=\"n\">requirements</span> <span class=\"o\">=</span> <span class=\"p\">{</span> <span class=\"s\">&#39;page&#39;</span><span class=\"p\">:</span><span class=\"s\">&#39;\\d{1,2}&#39;</span> <span class=\"p\">})</span>\n<span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">connect</span><span class=\"p\">(</span><span class=\"s\">&#39;category_list&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;archives/category/:section&#39;</span><span class=\"p\">,</span> <span class=\"n\">controller</span><span class=\"o\">=</span><span class=\"s\">&#39;blog&#39;</span><span class=\"p\">,</span> <span class=\"n\">action</span><span class=\"o\">=</span><span class=\"s\">&#39;category&#39;</span><span class=\"p\">,</span>\n<span class=\"n\">section</span><span class=\"o\">=</span><span class=\"s\">&#39;home&#39;</span><span class=\"p\">,</span> <span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;list&#39;</span><span class=\"p\">)</span>\n<span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">connect</span><span class=\"p\">(</span><span class=\"s\">&#39;home&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;&#39;</span><span class=\"p\">,</span> <span class=\"n\">controller</span><span class=\"o\">=</span><span class=\"s\">&#39;blog&#39;</span><span class=\"p\">,</span> <span class=\"n\">action</span><span class=\"o\">=</span><span class=\"s\">&#39;view&#39;</span><span class=\"p\">,</span> <span class=\"n\">section</span><span class=\"o\">=</span><span class=\"s\">&#39;home&#39;</span><span class=\"p\">)</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Mapper.create_regs\">\n<!--[routes.base.Mapper.create_regs]--><tt class=\"descname\">create_regs</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Mapper.create_regs\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Atomically creates regular expressions for all connected\nroutes</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Mapper.generate\">\n<!--[routes.base.Mapper.generate]--><tt class=\"descname\">generate</tt><big>(</big><em>*args</em>, <em>**kargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Mapper.generate\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Generate a route from a set of keywords</p>\n<p>Returns the url text, or None if no URL could be generated.</p>\n<div class=\"highlight\"><pre><span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">generate</span><span class=\"p\">(</span><span class=\"n\">controller</span><span class=\"o\">=</span><span class=\"s\">&#39;content&#39;</span><span class=\"p\">,</span><span class=\"n\">action</span><span class=\"o\">=</span><span class=\"s\">&#39;view&#39;</span><span class=\"p\">,</span><span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"mf\">10</span><span class=\"p\">)</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Mapper.match\">\n<!--[routes.base.Mapper.match]--><tt class=\"descname\">match</tt><big>(</big><em>url</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Mapper.match\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Match a URL against against one of the routes contained.</p>\n<p>Will return None if no valid match is found.</p>\n<div class=\"highlight\"><pre><span class=\"n\">resultdict</span> <span class=\"o\">=</span> <span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">match</span><span class=\"p\">(</span><span class=\"s\">&#39;/joe/sixpack&#39;</span><span class=\"p\">)</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Mapper.redirect\">\n<!--[routes.base.Mapper.redirect]--><tt class=\"descname\">redirect</tt><big>(</big><em>match_path</em>, <em>destination_path</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Mapper.redirect\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Add a redirect route to the mapper</p>\n<p>Redirect routes bypass the wrapped WSGI application and instead\nresult in a redirect being issued by the RoutesMiddleware. As\nsuch, this method is only meaningful when using\nRoutesMiddleware.</p>\n<p>By default, a 302 Found status code is used, this can be\nchanged by providing a <tt class=\"docutils literal\"><span class=\"pre\">_redirect_code</span></tt> keyword argument\nwhich will then be used instead. Note that the entire status\ncode string needs to be present.</p>\n<p>When using keyword arguments, all arguments that apply to\nmatching will be used for the match, while generation specific\noptions will be used during generation. Thus all options\nnormally available to connected Routes may be used with\nredirect routes as well.</p>\n<p>Example:</p>\n<pre>map = Mapper()\nmap.redirect('/legacyapp/archives/{url:.*}, '/archives/{url})\nmap.redirect('/home/index', '/', _redirect_code='301 Moved Permanently')</pre>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Mapper.resource\">\n<!--[routes.base.Mapper.resource]--><tt class=\"descname\">resource</tt><big>(</big><em>member_name</em>, <em>collection_name</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Mapper.resource\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Generate routes for a controller resource</p>\n<p>The member_name name should be the appropriate singular version\nof the resource given your locale and used with members of the\ncollection. The collection_name name will be used to refer to\nthe resource collection methods and should be a plural version\nof the member_name argument. By default, the member_name name\nwill also be assumed to map to a controller you create.</p>\n<p>The concept of a web resource maps somewhat directly to &#8216;CRUD&#8217; \noperations. The overlying things to keep in mind is that\nmapping a resource is about handling creating, viewing, and\nediting that resource.</p>\n<p>All keyword arguments are optional.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">controller</span></tt></dt>\n<dd>If specified in the keyword args, the controller will be\nthe actual controller used, but the rest of the naming\nconventions used for the route names and URL paths are\nunchanged.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">collection</span></tt></dt>\n<dd><p class=\"first\">Additional action mappings used to manipulate/view the\nentire set of resources provided by the controller.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"nb\">map</span><span class=\"o\">.</span><span class=\"n\">resource</span><span class=\"p\">(</span><span class=\"s\">&#39;message&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;messages&#39;</span><span class=\"p\">,</span> <span class=\"n\">collection</span><span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s\">&#39;rss&#39;</span><span class=\"p\">:</span><span class=\"s\">&#39;GET&#39;</span><span class=\"p\">})</span>\n<span class=\"c\"># GET /message/rss (maps to the rss action)</span>\n<span class=\"c\"># also adds named route &quot;rss_message&quot;</span>\n</pre></div>\n</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">member</span></tt></dt>\n<dd><p class=\"first\">Additional action mappings used to access an individual\n&#8216;member&#8217; of this controllers resources.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"nb\">map</span><span class=\"o\">.</span><span class=\"n\">resource</span><span class=\"p\">(</span><span class=\"s\">&#39;message&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;messages&#39;</span><span class=\"p\">,</span> <span class=\"n\">member</span><span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s\">&#39;mark&#39;</span><span class=\"p\">:</span><span class=\"s\">&#39;POST&#39;</span><span class=\"p\">})</span>\n<span class=\"c\"># POST /message/1/mark (maps to the mark action)</span>\n<span class=\"c\"># also adds named route &quot;mark_message&quot;</span>\n</pre></div>\n</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">new</span></tt></dt>\n<dd><p class=\"first\">Action mappings that involve dealing with a new member in\nthe controller resources.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"nb\">map</span><span class=\"o\">.</span><span class=\"n\">resource</span><span class=\"p\">(</span><span class=\"s\">&#39;message&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;messages&#39;</span><span class=\"p\">,</span> <span class=\"n\">new</span><span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s\">&#39;preview&#39;</span><span class=\"p\">:</span><span class=\"s\">&#39;POST&#39;</span><span class=\"p\">})</span>\n<span class=\"c\"># POST /message/new/preview (maps to the preview action)</span>\n<span class=\"c\"># also adds a url named &quot;preview_new_message&quot;</span>\n</pre></div>\n</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">path_prefix</span></tt></dt>\n<dd>Prepends the URL path for the Route with the path_prefix\ngiven. This is most useful for cases where you want to mix\nresources or relations between resources.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">name_prefix</span></tt></dt>\n<dd><p class=\"first\">Perpends the route names that are generated with the\nname_prefix given. Combined with the path_prefix option,\nit&#8217;s easy to generate route names and paths that represent\nresources that are in relations.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"nb\">map</span><span class=\"o\">.</span><span class=\"n\">resource</span><span class=\"p\">(</span><span class=\"s\">&#39;message&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;messages&#39;</span><span class=\"p\">,</span> <span class=\"n\">controller</span><span class=\"o\">=</span><span class=\"s\">&#39;categories&#39;</span><span class=\"p\">,</span> \n    <span class=\"n\">path_prefix</span><span class=\"o\">=</span><span class=\"s\">&#39;/category/:category_id&#39;</span><span class=\"p\">,</span> \n    <span class=\"n\">name_prefix</span><span class=\"o\">=</span><span class=\"s\">&quot;category_&quot;</span><span class=\"p\">)</span>\n<span class=\"c\"># GET /category/7/message/1</span>\n<span class=\"c\"># has named route &quot;category_message&quot;</span>\n</pre></div>\n</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">parent_resource</span></tt> </dt>\n<dd><p class=\"first\">A <tt class=\"docutils literal\"><span class=\"pre\">dict</span></tt> containing information about the parent\nresource, for creating a nested resource. It should contain\nthe <tt class=\"docutils literal\"><span class=\"pre\">member_name</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">collection_name</span></tt> of the parent\nresource. This <tt class=\"docutils literal\"><span class=\"pre\">dict</span></tt> will \nbe available via the associated <tt class=\"docutils literal\"><span class=\"pre\">Route</span></tt> object which can\nbe accessed during a request via\n<tt class=\"docutils literal\"><span class=\"pre\">request.environ['routes.route']</span></tt></p>\n<p>If <tt class=\"docutils literal\"><span class=\"pre\">parent_resource</span></tt> is supplied and <tt class=\"docutils literal\"><span class=\"pre\">path_prefix</span></tt>\nisn&#8217;t, <tt class=\"docutils literal\"><span class=\"pre\">path_prefix</span></tt> will be generated from\n<tt class=\"docutils literal\"><span class=\"pre\">parent_resource</span></tt> as\n&#8220;&lt;parent collection name&gt;/:&lt;parent member name&gt;_id&#8221;.</p>\n<p>If <tt class=\"docutils literal\"><span class=\"pre\">parent_resource</span></tt> is supplied and <tt class=\"docutils literal\"><span class=\"pre\">name_prefix</span></tt>\nisn&#8217;t, <tt class=\"docutils literal\"><span class=\"pre\">name_prefix</span></tt> will be generated from\n<tt class=\"docutils literal\"><span class=\"pre\">parent_resource</span></tt> as  &#8220;&lt;parent member name&gt;_&#8221;.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">from</span> <span class=\"nn\">routes.util</span> <span class=\"k\">import</span> <span class=\"n\">url_for</span> \n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">m</span> <span class=\"o\">=</span> <span class=\"n\">Mapper</span><span class=\"p\">()</span> \n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">resource</span><span class=\"p\">(</span><span class=\"s\">&#39;location&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;locations&#39;</span><span class=\"p\">,</span> \n<span class=\"gp\">... </span>           <span class=\"n\">parent_resource</span><span class=\"o\">=</span><span class=\"nb\">dict</span><span class=\"p\">(</span><span class=\"n\">member_name</span><span class=\"o\">=</span><span class=\"s\">&#39;region&#39;</span><span class=\"p\">,</span> \n<span class=\"gp\">... </span>                                <span class=\"n\">collection_name</span><span class=\"o\">=</span><span class=\"s\">&#39;regions&#39;</span><span class=\"p\">))</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"c\"># path_prefix is &quot;regions/:region_id&quot; </span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"c\"># name prefix is &quot;region_&quot;  </span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;region_locations&#39;</span><span class=\"p\">,</span> <span class=\"n\">region_id</span><span class=\"o\">=</span><span class=\"mf\">13</span><span class=\"p\">)</span> \n<span class=\"go\">&#39;/regions/13/locations&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;region_new_location&#39;</span><span class=\"p\">,</span> <span class=\"n\">region_id</span><span class=\"o\">=</span><span class=\"mf\">13</span><span class=\"p\">)</span> \n<span class=\"go\">&#39;/regions/13/locations/new&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;region_location&#39;</span><span class=\"p\">,</span> <span class=\"n\">region_id</span><span class=\"o\">=</span><span class=\"mf\">13</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"mf\">60</span><span class=\"p\">)</span> \n<span class=\"go\">&#39;/regions/13/locations/60&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;region_edit_location&#39;</span><span class=\"p\">,</span> <span class=\"n\">region_id</span><span class=\"o\">=</span><span class=\"mf\">13</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"mf\">60</span><span class=\"p\">)</span> \n<span class=\"go\">&#39;/regions/13/locations/60/edit&#39;</span>\n</pre></div>\n<p>Overriding generated <tt class=\"docutils literal\"><span class=\"pre\">path_prefix</span></tt>:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">m</span> <span class=\"o\">=</span> <span class=\"n\">Mapper</span><span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">resource</span><span class=\"p\">(</span><span class=\"s\">&#39;location&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;locations&#39;</span><span class=\"p\">,</span>\n<span class=\"gp\">... </span>           <span class=\"n\">parent_resource</span><span class=\"o\">=</span><span class=\"nb\">dict</span><span class=\"p\">(</span><span class=\"n\">member_name</span><span class=\"o\">=</span><span class=\"s\">&#39;region&#39;</span><span class=\"p\">,</span>\n<span class=\"gp\">... </span>                                <span class=\"n\">collection_name</span><span class=\"o\">=</span><span class=\"s\">&#39;regions&#39;</span><span class=\"p\">),</span>\n<span class=\"gp\">... </span>           <span class=\"n\">path_prefix</span><span class=\"o\">=</span><span class=\"s\">&#39;areas/:area_id&#39;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"c\"># name prefix is &quot;region_&quot;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;region_locations&#39;</span><span class=\"p\">,</span> <span class=\"n\">area_id</span><span class=\"o\">=</span><span class=\"mf\">51</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;/areas/51/locations&#39;</span>\n</pre></div>\n<p>Overriding generated <tt class=\"docutils literal\"><span class=\"pre\">name_prefix</span></tt>:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">m</span> <span class=\"o\">=</span> <span class=\"n\">Mapper</span><span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">resource</span><span class=\"p\">(</span><span class=\"s\">&#39;location&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;locations&#39;</span><span class=\"p\">,</span>\n<span class=\"gp\">... </span>           <span class=\"n\">parent_resource</span><span class=\"o\">=</span><span class=\"nb\">dict</span><span class=\"p\">(</span><span class=\"n\">member_name</span><span class=\"o\">=</span><span class=\"s\">&#39;region&#39;</span><span class=\"p\">,</span>\n<span class=\"gp\">... </span>                                <span class=\"n\">collection_name</span><span class=\"o\">=</span><span class=\"s\">&#39;regions&#39;</span><span class=\"p\">),</span>\n<span class=\"gp\">... </span>           <span class=\"n\">name_prefix</span><span class=\"o\">=</span><span class=\"s\">&#39;&#39;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"c\"># path_prefix is &quot;regions/:region_id&quot; </span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;locations&#39;</span><span class=\"p\">,</span> <span class=\"n\">region_id</span><span class=\"o\">=</span><span class=\"mf\">51</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;/regions/51/locations&#39;</span>\n</pre></div>\n</dd>\n</dl>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"routes.base.Mapper.routematch\">\n<!--[routes.base.Mapper.routematch]--><tt class=\"descname\">routematch</tt><big>(</big><em>url</em><big>)</big><a class=\"headerlink\" href=\"#routes.base.Mapper.routematch\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Match a URL against against one of the routes contained.</p>\n<p>Will return None if no valid match is found, otherwise a\nresult dict and a route object is returned.</p>\n<div class=\"highlight\"><pre><span class=\"n\">resultdict</span><span class=\"p\">,</span> <span class=\"n\">route_obj</span> <span class=\"o\">=</span> <span class=\"n\">m</span><span class=\"o\">.</span><span class=\"n\">match</span><span class=\"p\">(</span><span class=\"s\">&#39;/joe/sixpack&#39;</span><span class=\"p\">)</span>\n</pre></div>\n</dd></dl>\n\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-routes.util\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">routes.util</span></tt><a class=\"headerlink\" href=\"#module-routes.util\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Utility functions for use in templates / controllers</p>\n<p><em>PLEASE NOTE</em>: Many of these functions expect an initialized RequestConfig\nobject. This is expected to have been initialized for EACH REQUEST by the web\nframework.</p>\n<dl class=\"function\">\n<dt id=\"routes.util.url_for\">\n<!--[routes.util.url_for]--><tt class=\"descclassname\">routes.util.</tt><tt class=\"descname\">url_for</tt><big>(</big><em>*args</em>, <em>**kargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.util.url_for\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Generates a URL</p>\n<p>All keys given to url_for are sent to the Routes Mapper instance for \ngeneration except for:</p>\n<pre>anchor          specified the anchor name to be appened to the path\nhost            overrides the default (current) host if provided\nprotocol        overrides the default (current) protocol if provided\nqualified       creates the URL with the host/port information as \n                needed</pre>\n<p>The URL is generated based on the rest of the keys. When generating a new \nURL, values will be used from the current request&#8217;s parameters (if \npresent). The following rules are used to determine when and how to keep \nthe current requests parameters:</p>\n<ul class=\"simple\">\n<li>If the controller is present and begins with &#8216;/&#8217;, no defaults are used</li>\n<li>If the controller is changed, action is set to &#8216;index&#8217; unless otherwise \nspecified</li>\n</ul>\n<p>For example, if the current request yielded a dict of\n{&#8216;controller&#8217;: &#8216;blog&#8217;, &#8216;action&#8217;: &#8216;view&#8217;, &#8216;id&#8217;: 2}, with the standard \n&#8216;:controller/:action/:id&#8217; route, you&#8217;d get the following results:</p>\n<pre>url_for(id=4)                    =&gt;  '/blog/view/4',\nurl_for(controller='/admin')     =&gt;  '/admin',\nurl_for(controller='admin')      =&gt;  '/admin/view/2'\nurl_for(action='edit')           =&gt;  '/blog/edit/2',\nurl_for(action='list', id=None)  =&gt;  '/blog/list'</pre>\n<p><strong>Static and Named Routes</strong></p>\n<p>If there is a string present as the first argument, a lookup is done \nagainst the named routes table to see if there&#8217;s any matching routes. The\nkeyword defaults used with static routes will be sent in as GET query \narg&#8217;s if a route matches.</p>\n<p>If no route by that name is found, the string is assumed to be a raw URL. \nShould the raw URL begin with <tt class=\"docutils literal\"><span class=\"pre\">/</span></tt> then appropriate SCRIPT_NAME data will\nbe added if present, otherwise the string will be used as the url with \nkeyword args becoming GET query args.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"routes.util.redirect_to\">\n<!--[routes.util.redirect_to]--><tt class=\"descclassname\">routes.util.</tt><tt class=\"descname\">redirect_to</tt><big>(</big><em>*args</em>, <em>**kargs</em><big>)</big><a class=\"headerlink\" href=\"#routes.util.redirect_to\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Issues a redirect based on the arguments.</p>\n<p>Redirect&#8217;s <em>should</em> occur as a &#8220;302 Moved&#8221; header, however the web \nframework may utilize a different method.</p>\n<p>All arguments are passed to url_for to retrieve the appropriate URL, then\nthe resulting URL it sent to the redirect function as the URL.</p>\n</dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "thirdparty/routes", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 04048eb9797db0625988d1b5dd4c396b
-ETag: 2806658417
+ETag: 668377217
 
 {
   "_id": "04048eb9797db0625988d1b5dd4c396b", 
-  "_rev": "2806658417", 
+  "_rev": "668377217", 
   "body": "<div class=\"section\" id=\"pagination-webhelpers-pagination-part-deprecated\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">pagination</span></tt> &#8211; WebHelpers Pagination <em>(part deprecated)</em><a class=\"headerlink\" href=\"#pagination-webhelpers-pagination-part-deprecated\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"links\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">links</span></tt><a class=\"headerlink\" href=\"#links\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.pagination.links.pagelist\">\n<!--[webhelpers.pagination.links.pagelist]--><tt class=\"descclassname\">webhelpers.pagination.links.</tt><tt class=\"descname\">pagelist</tt><big>(</big><em>page</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.pagination.links.pagelist\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>PHPbb style Pagination Links - return HTML to be included in page.</p>\n<p>The html source is generated with htmlgen.</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"orm\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">orm</span></tt><a class=\"headerlink\" href=\"#orm\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Deprecated: Use <tt class=\"docutils literal\"><span class=\"pre\">webhelpers.paginate</span></tt></p>\n</div>\n</div>\n</div>\n", 
   "current_page_name": "thirdparty/webhelpers/pagination/pagination", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 097337c75773737022bb4e8cd3a92140
-ETag: 499206429
+ETag: 612277023
 
 {
   "_id": "097337c75773737022bb4e8cd3a92140", 
-  "_rev": "499206429", 
+  "_rev": "612277023", 
   "blog": null, 
   "created": "2008-10-01T19:40:25Z", 
   "last_login": "2008-10-01T19:40:25Z", 
   "type": "Human", 
   "username": null
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 0b64de3d5a37b9e085941c68f0a94ace
-ETag: 3847638380
+ETag: 965513717
 
 {
   "_id": "0b64de3d5a37b9e085941c68f0a94ace", 
-  "_rev": "3847638380", 
+  "_rev": "965513717", 
   "body": "<div class=\"section\" id=\"module-pylons.commands\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">pylons.commands</span></tt> &#8211; Command line functions<a class=\"headerlink\" href=\"#module-pylons.commands\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<p>Paster Commands, for use with paster in your project</p>\n<p>The following commands are made available via paster utilizing\nsetuptools points discovery. These can be used from the command line\nwhen the directory is the Pylons project.</p>\n<p>Commands available:</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">controller</span></tt></dt>\n<dd>Create a Controller and accompanying functional test</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">restcontroller</span></tt></dt>\n<dd>Create a REST Controller and accompanying functional test</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">shell</span></tt></dt>\n<dd>Open an interactive shell with the Pylons app loaded</dd>\n</dl>\n<p>Example usage:</p>\n<pre>~/sample$ paster controller account\nCreating /Users/ben/sample/sample/controllers/account.py\nCreating /Users/ben/sample/sample/tests/functional/test_account.py\n~/sample$</pre>\n<div class=\"admonition-how-it-works admonition \">\n<p class=\"first admonition-title\">How it Works</p>\n<p><strong>paster</strong> is a command line script (from the PasteScript\npackage) that allows the creation of context sensitive commands.\n<strong>paster</strong> looks in the current directory for a \n<tt class=\"docutils literal\"><span class=\"pre\">.egg-info</span></tt> directory, then loads the <tt class=\"docutils literal\"><span class=\"pre\">paster_plugins.txt</span></tt>\nfile.</p>\n<p>Using setuptools entry points, <strong>paster</strong> looks for\nfunctions registered with setuptools as \n<tt class=\"xref docutils literal\"><span class=\"pre\">paste.paster_command()</span></tt>. These are defined in the entry_points\nblock in each packages <tt class=\"docutils literal\"><span class=\"pre\">setup.py</span></tt> module.</p>\n<p class=\"last\">This same system is used when running <strong>paster create</strong> to\ndetermine what templates are available when creating new projects.</p>\n</div>\n<div class=\"section\" id=\"module-contents\">\n<h2>Module Contents<a class=\"headerlink\" href=\"#module-contents\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"pylons.commands.ControllerCommand\">\n<!--[pylons.commands.ControllerCommand]-->class <tt class=\"descclassname\">pylons.commands.</tt><tt class=\"descname\">ControllerCommand</tt><big>(</big><em>name</em><big>)</big><a class=\"headerlink\" href=\"#pylons.commands.ControllerCommand\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a Controller and accompanying functional test</p>\n<p>The Controller command will create the standard controller template\nfile and associated functional test to speed creation of\ncontrollers.</p>\n<p>Example usage:</p>\n<div class=\"highlight\"><pre>yourproj% paster controller comments\nCreating yourproj/yourproj/controllers/comments.py\nCreating yourproj/yourproj/tests/functional/test_comments.py\n</pre></div>\n<p>If you&#8217;d like to have controllers underneath a directory, just\ninclude the path as the controller name and the necessary\ndirectories will be created for you:</p>\n<div class=\"highlight\"><pre>yourproj% paster controller admin/trackback\nCreating yourproj/controllers/admin\nCreating yourproj/yourproj/controllers/admin/trackback.py\nCreating yourproj/yourproj/tests/functional/test_admin_trackback.py\n</pre></div>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"pylons.commands.RestControllerCommand\">\n<!--[pylons.commands.RestControllerCommand]-->class <tt class=\"descclassname\">pylons.commands.</tt><tt class=\"descname\">RestControllerCommand</tt><big>(</big><em>name</em><big>)</big><a class=\"headerlink\" href=\"#pylons.commands.RestControllerCommand\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a REST Controller and accompanying functional test</p>\n<p>The RestController command will create a REST-based Controller file\nfor use with the <tt class=\"xref docutils literal\"><span class=\"pre\">resource()</span></tt>\nREST-based dispatching. This template includes the methods that\n<tt class=\"xref docutils literal\"><span class=\"pre\">resource()</span></tt> dispatches to in\naddition to doc strings for clarification on when the methods will\nbe called.</p>\n<p>The first argument should be the singular form of the REST\nresource. The second argument is the plural form of the word. If\nits a nested controller, put the directory information in front as\nshown in the second example below.</p>\n<p>Example usage:</p>\n<div class=\"highlight\"><pre>yourproj% paster restcontroller comment comments\nCreating yourproj/yourproj/controllers/comments.py\nCreating yourproj/yourproj/tests/functional/test_comments.py\n</pre></div>\n<p>If you&#8217;d like to have controllers underneath a directory, just\ninclude the path as the controller name and the necessary\ndirectories will be created for you:</p>\n<div class=\"highlight\"><pre>yourproj% paster restcontroller admin/tracback admin/trackbacks\nCreating yourproj/controllers/admin\nCreating yourproj/yourproj/controllers/admin/trackbacks.py\nCreating yourproj/yourproj/tests/functional/test_admin_trackbacks.py\n</pre></div>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"pylons.commands.ShellCommand\">\n<!--[pylons.commands.ShellCommand]-->class <tt class=\"descclassname\">pylons.commands.</tt><tt class=\"descname\">ShellCommand</tt><big>(</big><em>name</em><big>)</big><a class=\"headerlink\" href=\"#pylons.commands.ShellCommand\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Open an interactive shell with the Pylons app loaded</p>\n<p>The optional CONFIG_FILE argument specifies the config file to use for\nthe interactive shell. CONFIG_FILE defaults to &#8216;development.ini&#8217;.</p>\n<p>This allows you to test your mapper, models, and simulate web requests\nusing <tt class=\"docutils literal\"><span class=\"pre\">paste.fixture</span></tt>.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span>paster shell my-development.ini\n</pre></div>\n</dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "modules/commands", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 0e4dd225ae62d8be1154abab02a95bb5
-ETag: 4238101079
+ETag: 4062945833
 
 {
   "_id": "0e4dd225ae62d8be1154abab02a95bb5", 
-  "_rev": "4238101079", 
+  "_rev": "4062945833", 
   "body": "<div class=\"section\" id=\"module-pylons.wsgiapp\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">pylons.wsgiapp</span></tt> &#8211; PylonsWSGI App Creator<a class=\"headerlink\" href=\"#module-pylons.wsgiapp\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<p>WSGI App Creator</p>\n<p>This module is responsible for creating the basic Pylons WSGI\napplication (PylonsApp). It&#8217;s generally assumed that it will be called\nby Paste, though any WSGI server could create and call the WSGI app as\nwell.</p>\n<div class=\"section\" id=\"module-contents\">\n<h2>Module Contents<a class=\"headerlink\" href=\"#module-contents\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"pylons.wsgiapp.PylonsApp\">\n<!--[pylons.wsgiapp.PylonsApp]-->class <tt class=\"descclassname\">pylons.wsgiapp.</tt><tt class=\"descname\">PylonsApp</tt><big>(</big><em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#pylons.wsgiapp.PylonsApp\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Pylons WSGI Application</p>\n<p>This basic WSGI app is provided should a web developer want to\nget access to the most basic Pylons web application environment\navailable. By itself, this Pylons web application does little more\nthan dispatch to a controller and setup the context object, the\nrequest object, and the globals object.</p>\n<p>Additional functionality like sessions, and caching can be setup by\naltering the <tt class=\"docutils literal\"><span class=\"pre\">environ['pylons.environ_config']</span></tt> setting to\nindicate what key the <tt class=\"docutils literal\"><span class=\"pre\">session</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">cache</span></tt> functionality\nshould come from.</p>\n<p>Resolving the URL and dispatching can be customized by sub-classing\nor &#8220;monkey-patching&#8221; this class. Subclassing is the preferred\napproach.</p>\n<dl class=\"method\">\n<dt id=\"pylons.wsgiapp.PylonsApp.__call__\">\n<!--[pylons.wsgiapp.PylonsApp.__call__]--><tt class=\"descname\">__call__</tt><big>(</big><em>environ</em>, <em>start_response</em><big>)</big><a class=\"headerlink\" href=\"#pylons.wsgiapp.PylonsApp.__call__\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Setup and handle a web request</p>\n<p>PylonsApp splits its functionality into several methods to\nmake it easier to subclass and customize core functionality.</p>\n<p>The methods are called in the following order:</p>\n<ol class=\"arabic simple\">\n<li><a title=\"pylons.wsgiapp.PylonsApp.setup_app_env\" class=\"reference internal\" href=\"#pylons.wsgiapp.PylonsApp.setup_app_env\"><tt class=\"xref docutils literal\"><span class=\"pre\">setup_app_env()</span></tt></a></li>\n<li><a title=\"pylons.wsgiapp.PylonsApp.load_test_env\" class=\"reference internal\" href=\"#pylons.wsgiapp.PylonsApp.load_test_env\"><tt class=\"xref docutils literal\"><span class=\"pre\">load_test_env()</span></tt></a> (Only if operating in\ntesting mode)</li>\n<li><a title=\"pylons.wsgiapp.PylonsApp.resolve\" class=\"reference internal\" href=\"#pylons.wsgiapp.PylonsApp.resolve\"><tt class=\"xref docutils literal\"><span class=\"pre\">resolve()</span></tt></a></li>\n<li><a title=\"pylons.wsgiapp.PylonsApp.dispatch\" class=\"reference internal\" href=\"#pylons.wsgiapp.PylonsApp.dispatch\"><tt class=\"xref docutils literal\"><span class=\"pre\">dispatch()</span></tt></a></li>\n</ol>\n<p>The response from <a title=\"pylons.wsgiapp.PylonsApp.dispatch\" class=\"reference internal\" href=\"#pylons.wsgiapp.PylonsApp.dispatch\"><tt class=\"xref docutils literal\"><span class=\"pre\">dispatch()</span></tt></a> is expected to be\nan iterable (valid <span class=\"target\" id=\"index-9\"></span><a class=\"reference external\" href=\"http://www.python.org/dev/peps/pep-0333\"><strong>PEP 333</strong></a> WSGI response), which is then\nsent back as the response.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"pylons.wsgiapp.PylonsApp.dispatch\">\n<!--[pylons.wsgiapp.PylonsApp.dispatch]--><tt class=\"descname\">dispatch</tt><big>(</big><em>controller</em>, <em>environ</em>, <em>start_response</em><big>)</big><a class=\"headerlink\" href=\"#pylons.wsgiapp.PylonsApp.dispatch\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Dispatches to a controller, will instantiate the controller\nif necessary.</p>\n<p>Override this to change how the controller dispatch is handled.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"pylons.wsgiapp.PylonsApp.find_controller\">\n<!--[pylons.wsgiapp.PylonsApp.find_controller]--><tt class=\"descname\">find_controller</tt><big>(</big><em>controller</em><big>)</big><a class=\"headerlink\" href=\"#pylons.wsgiapp.PylonsApp.find_controller\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Locates a controller by attempting to import it then grab\nthe SomeController instance from the imported module.</p>\n<p>Override this to change how the controller object is found once\nthe URL has been resolved.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"pylons.wsgiapp.PylonsApp.load_test_env\">\n<!--[pylons.wsgiapp.PylonsApp.load_test_env]--><tt class=\"descname\">load_test_env</tt><big>(</big><em>environ</em><big>)</big><a class=\"headerlink\" href=\"#pylons.wsgiapp.PylonsApp.load_test_env\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Sets up our Paste testing environment</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"pylons.wsgiapp.PylonsApp.register_globals\">\n<!--[pylons.wsgiapp.PylonsApp.register_globals]--><tt class=\"descname\">register_globals</tt><big>(</big><em>environ</em><big>)</big><a class=\"headerlink\" href=\"#pylons.wsgiapp.PylonsApp.register_globals\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Registers globals in the environment, called from\n<a title=\"pylons.wsgiapp.PylonsApp.setup_app_env\" class=\"reference internal\" href=\"#pylons.wsgiapp.PylonsApp.setup_app_env\"><tt class=\"xref docutils literal\"><span class=\"pre\">setup_app_env()</span></tt></a></p>\n<p>Override this to control how the Pylons API is setup. Note that\na custom render function will need to be used if the \n<tt class=\"docutils literal\"><span class=\"pre\">pylons.app_globals</span></tt> global is not available.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"pylons.wsgiapp.PylonsApp.resolve\">\n<!--[pylons.wsgiapp.PylonsApp.resolve]--><tt class=\"descname\">resolve</tt><big>(</big><em>environ</em>, <em>start_response</em><big>)</big><a class=\"headerlink\" href=\"#pylons.wsgiapp.PylonsApp.resolve\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Uses dispatching information found in \n<tt class=\"docutils literal\"><span class=\"pre\">environ['wsgiorg.routing_args']</span></tt> to retrieve a controller\nname and return the controller instance from the appropriate\ncontroller module.</p>\n<p>Override this to change how the controller name is found and\nreturned.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"pylons.wsgiapp.PylonsApp.setup_app_env\">\n<!--[pylons.wsgiapp.PylonsApp.setup_app_env]--><tt class=\"descname\">setup_app_env</tt><big>(</big><em>environ</em>, <em>start_response</em><big>)</big><a class=\"headerlink\" href=\"#pylons.wsgiapp.PylonsApp.setup_app_env\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Setup and register all the Pylons objects with the registry</p>\n<p>After creating all the global objects for use in the request,\n<a title=\"pylons.wsgiapp.PylonsApp.register_globals\" class=\"reference internal\" href=\"#pylons.wsgiapp.PylonsApp.register_globals\"><tt class=\"xref docutils literal\"><span class=\"pre\">register_globals()</span></tt></a> is called to register them\nin the environment.</p>\n</dd></dl>\n\n</dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "modules/wsgiapp", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 0f8b898596eaccfe4751c73ac9e952a9
-ETag: 3778596197
+ETag: 2099214952
 
 {
   "_id": "0f8b898596eaccfe4751c73ac9e952a9", 
-  "_rev": "3778596197", 
+  "_rev": "2099214952", 
   "body": "<div class=\"section\" id=\"adding-commands-to-paster\">\n<h1>Adding commands to Paster<a class=\"headerlink\" href=\"#adding-commands-to-paster\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"paster-command\">\n<h2>Paster command<a class=\"headerlink\" href=\"#paster-command\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>The command line will be <tt class=\"docutils literal\"><span class=\"pre\">paster</span> <span class=\"pre\">my-command</span> <span class=\"pre\">arg1</span> <span class=\"pre\">arg2</span></tt> if the current directory is the application egg, or <tt class=\"docutils literal\"><span class=\"pre\">paster</span> <span class=\"pre\">--plugin=MyPylonsApp</span> <span class=\"pre\">my-command</span> <span class=\"pre\">arg1</span> <span class=\"pre\">arg2</span></tt> otherwise.  In the latter case, <tt class=\"docutils literal\"><span class=\"pre\">MyPylonsApp</span></tt> must have been installed via <tt class=\"docutils literal\"><span class=\"pre\">easy_install</span></tt> or <tt class=\"docutils literal\"><span class=\"pre\">python</span> <span class=\"pre\">setup.py</span> <span class=\"pre\">develop</span></tt>.</p>\n<p>Make a package directory for your commands:</p>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span>mkdir myapp/commands\n<span class=\"nv\">$ </span>touch myapp/commands/__init__.py\n</pre></div>\n<p>Create a module <tt class=\"docutils literal\"><span class=\"pre\">myapp/commands/my_command.py</span></tt> like this:</p>\n<div class=\"highlight\"><pre><span class=\"k\">from</span> <span class=\"nn\">paste.script.command</span> <span class=\"k\">import</span> <span class=\"n\">Command</span>\n\n<span class=\"k\">class</span> <span class=\"nc\">MyCommand</span><span class=\"p\">(</span><span class=\"n\">Command</span><span class=\"p\">):</span>\n        <span class=\"c\"># Parser configuration</span>\n        <span class=\"n\">summary</span> <span class=\"o\">=</span> <span class=\"s\">&quot;--NO SUMMARY--&quot;</span>\n        <span class=\"n\">usage</span> <span class=\"o\">=</span> <span class=\"s\">&quot;--NO USAGE--&quot;</span>\n        <span class=\"n\">group_name</span> <span class=\"o\">=</span> <span class=\"s\">&quot;myapp&quot;</span>\n        <span class=\"n\">parser</span> <span class=\"o\">=</span> <span class=\"n\">Command</span><span class=\"o\">.</span><span class=\"n\">standard_parser</span><span class=\"p\">(</span><span class=\"n\">verbose</span><span class=\"o\">=</span><span class=\"bp\">False</span><span class=\"p\">)</span>\n\n        <span class=\"k\">def</span> <span class=\"nf\">command</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n                <span class=\"k\">import</span> <span class=\"nn\">pprint</span>\n                <span class=\"k\">print</span> <span class=\"s\">&quot;Hello, app script world!&quot;</span>\n                <span class=\"k\">print</span>\n                <span class=\"k\">print</span> <span class=\"s\">&quot;My options are:&quot;</span>\n                <span class=\"k\">print</span> <span class=\"s\">&quot;    &quot;</span><span class=\"p\">,</span> <span class=\"n\">pprint</span><span class=\"o\">.</span><span class=\"n\">pformat</span><span class=\"p\">(</span><span class=\"nb\">vars</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">options</span><span class=\"p\">))</span>\n                <span class=\"k\">print</span> <span class=\"s\">&quot;My args are:&quot;</span>\n                <span class=\"k\">print</span> <span class=\"s\">&quot;    &quot;</span><span class=\"p\">,</span> <span class=\"n\">pprint</span><span class=\"o\">.</span><span class=\"n\">pformat</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">args</span><span class=\"p\">)</span>\n                <span class=\"k\">print</span>\n                <span class=\"k\">print</span> <span class=\"s\">&quot;My parser help is:&quot;</span>\n                <span class=\"k\">print</span>\n                <span class=\"k\">print</span> <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">parser</span><span class=\"o\">.</span><span class=\"n\">format_help</span><span class=\"p\">()</span>\n</pre></div>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">The class _must_ define <tt class=\"docutils literal\"><span class=\"pre\">.command</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">.parser</span></tt>, and <tt class=\"docutils literal\"><span class=\"pre\">.summary</span></tt></p>\n</div>\n<p>Modify the <tt class=\"docutils literal\"><span class=\"pre\">entry_points</span></tt> argument in <tt class=\"docutils literal\"><span class=\"pre\">setup.py</span></tt> to contain:</p>\n<pre>[paste.paster_command]\nmy-command = myapp.commands.my_command:MyCommand</pre>\n<p>Run <tt class=\"docutils literal\"><span class=\"pre\">python</span> <span class=\"pre\">setup.py</span> <span class=\"pre\">develop</span></tt> or <tt class=\"docutils literal\"><span class=\"pre\">easy_install</span> <span class=\"pre\">.</span></tt> to update the entry points in the egg in sys.path.</p>\n<p>Now you should be able to run:</p>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span>paster --plugin<span class=\"o\">=</span>MyApp my-command arg1 arg2\nHello, MyApp script world!\n\nMy options are:\n         <span class=\"o\">{</span><span class=\"s1\">&#39;interactive&#39;</span>: False, <span class=\"s1\">&#39;overwrite&#39;</span>: False, <span class=\"s1\">&#39;quiet&#39;</span>: 0, <span class=\"s1\">&#39;verbose&#39;</span>: 0<span class=\"o\">}</span>\nMy args are:\n         <span class=\"o\">[</span><span class=\"s1\">&#39;arg1&#39;</span>, <span class=\"s1\">&#39;arg2&#39;</span><span class=\"o\">]</span>\n\nMy parser <span class=\"nb\">help </span>is:\n\nUsage: /usr/local/bin/paster my-command <span class=\"o\">[</span>options<span class=\"o\">]</span> --NO USAGE--\n--NO SUMMARY--\n\nOptions:\n  -h, --help  show this <span class=\"nb\">help </span>message and <span class=\"nb\">exit</span>\n\n<span class=\"nv\">$ </span>paster --plugin<span class=\"o\">=</span>MyApp --help\nUsage: paster <span class=\"o\">[</span>paster_options<span class=\"o\">]</span> COMMAND <span class=\"o\">[</span>command_options<span class=\"o\">]</span>\n\n...\nmyapp:\n  my-command      --NO SUMMARY--\n\npylons:\n  controller      Create a Controller and accompanying functional <span class=\"nb\">test</span>\n<span class=\"nb\">  </span>restcontroller  Create a REST Controller and accompanying functional <span class=\"nb\">test</span>\n<span class=\"nb\">  </span>shell           Open an interactive shell with the Pylons app loaded\n</pre></div>\n</div>\n<div class=\"section\" id=\"required-class-attributes\">\n<h2>Required class attributes<a class=\"headerlink\" href=\"#required-class-attributes\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>In addition to the <tt class=\"docutils literal\"><span class=\"pre\">.command</span></tt> method, the class should define <tt class=\"docutils literal\"><span class=\"pre\">.parser</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">.summary</span></tt>.</p>\n</div>\n<div class=\"section\" id=\"command-line-options\">\n<h2>Command-line options<a class=\"headerlink\" href=\"#command-line-options\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p><tt class=\"xref docutils literal\"><span class=\"pre\">Command.standard_parser()</span></tt> returns a Python <tt class=\"xref docutils literal\"><span class=\"pre\">OptionParser</span></tt>.  Calling <tt class=\"docutils literal\"><span class=\"pre\">parser.add_option</span></tt> enables the developer to add as many options as desired.  Inside the <tt class=\"docutils literal\"><span class=\"pre\">.command</span></tt> method, the user&#8217;s options are available under <tt class=\"docutils literal\"><span class=\"pre\">self.options</span></tt>, and any additional arguments are in <tt class=\"docutils literal\"><span class=\"pre\">self.args</span></tt>.</p>\n<p>There are several other class attributes that affect the parser; see them defined in <tt class=\"docutils literal\"><span class=\"pre\">paste.script.command:Command</span></tt>.  The most useful attributes are <tt class=\"docutils literal\"><span class=\"pre\">.usage</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">.description</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">.min_args</span></tt>, and <tt class=\"docutils literal\"><span class=\"pre\">.max_args</span></tt>.   <tt class=\"docutils literal\"><span class=\"pre\">.usage</span></tt> is the part of the usage string _after_ the command name.  The <tt class=\"docutils literal\"><span class=\"pre\">.standard_parser()</span></tt> method has several optional arguments to add standardized options; some of these got added to my parser although I don&#8217;t see how.</p>\n<p>See the <tt class=\"docutils literal\"><span class=\"pre\">paster</span> <span class=\"pre\">shell</span></tt> command, <tt class=\"docutils literal\"><span class=\"pre\">pylons.commands:ShellCommand</span></tt>, for an example of using command-line options and loading the <tt class=\"docutils literal\"><span class=\"pre\">.ini</span> <span class=\"pre\">file</span></tt> and model.</p>\n<p>Also see &#8220;paster setup-app&#8221; where it is defined in <tt class=\"docutils literal\"><span class=\"pre\">paste.script.appinstall.SetupCommand</span></tt>.  This is evident from the entry point in PasteScript  (<tt class=\"docutils literal\"><span class=\"pre\">PasteScript-VERSION.egg/EGG_INFO/entry_points.txt</span></tt>).  It is a complex example of reading a config file and delegating to another entry point.</p>\n<p>The code for calling <tt class=\"docutils literal\"><span class=\"pre\">myapp.websetup:setup_config</span></tt> is in <tt class=\"docutils literal\"><span class=\"pre\">paste.script.appinstall</span></tt>.</p>\n<p>The <tt class=\"docutils literal\"><span class=\"pre\">Command</span></tt> class also has several convenience methods to handle console prompts, enable logging, verify directories exist and that files have expected content, insert text into a file, run a shell command, add files to Subversion, parse &#8220;var=value&#8221; arguments, add variables to an .ini file.</p>\n</div>\n<div class=\"section\" id=\"using-paster-to-access-a-pylons-app\">\n<h2>Using paster to access a Pylons app<a class=\"headerlink\" href=\"#using-paster-to-access-a-pylons-app\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Paster provides <tt class=\"docutils literal\"><span class=\"pre\">request</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">post</span></tt> commands for running requests on an application. These commands will be run in the full configuration context of a normal application.  Useful for cron jobs, the error handler will also be in place and you can get email reports of failed requests.</p>\n<p>Because arguments all just go in <tt class=\"docutils literal\"><span class=\"pre\">QUERY_STRING</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">request.GET</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">request.PARAMS</span></tt> won&#8217;t look like you expect.  But you can parse them with\nsomething like:</p>\n<div class=\"highlight\"><pre><span class=\"n\">parser</span> <span class=\"o\">=</span> <span class=\"n\">optparse</span><span class=\"o\">.</span><span class=\"n\">OptionParser</span><span class=\"p\">()</span>\n<span class=\"n\">parser</span><span class=\"o\">.</span><span class=\"n\">add_option</span><span class=\"p\">(</span><span class=\"n\">etc</span><span class=\"p\">)</span>\n\n<span class=\"n\">args</span> <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"n\">item</span><span class=\"p\">[</span><span class=\"mf\">0</span><span class=\"p\">]</span> <span class=\"k\">for</span> <span class=\"n\">item</span> <span class=\"ow\">in</span>\n        <span class=\"n\">cgi</span><span class=\"o\">.</span><span class=\"n\">parse_qsl</span><span class=\"p\">(</span><span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">environ</span><span class=\"p\">[</span><span class=\"s\">&#39;QUERY_STRING&#39;</span><span class=\"p\">])]</span>\n\n<span class=\"n\">options</span><span class=\"p\">,</span> <span class=\"n\">args</span> <span class=\"o\">=</span> <span class=\"n\">parser</span><span class=\"o\">.</span><span class=\"n\">parse_args</span><span class=\"p\">(</span><span class=\"n\">args</span><span class=\"p\">)</span>\n</pre></div>\n<div class=\"section\" id=\"paster-request-post\">\n<h3>paster request / post<a class=\"headerlink\" href=\"#paster-request-post\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Usage: paster request / post [options] CONFIG_FILE URL [OPTIONS/ARGUMENTS]</p>\n<p>Run a request for the described application</p>\n<p>This command makes an artifical request to a web application that uses a\n<tt class=\"docutils literal\"><span class=\"pre\">paste.deploy</span></tt> configuration file for the server and application.  Use &#8216;paster\nrequest config.ini /url&#8217; to request <tt class=\"docutils literal\"><span class=\"pre\">/url</span></tt>.</p>\n<p>Use &#8216;paster post config.ini /url &lt; data&#8217; to do a POST with the given request body.</p>\n<p>If the URL is relative (i.e. doesn&#8217;t begin with /) it is interpreted as relative to /.command/.</p>\n<p>The variable <tt class=\"docutils literal\"><span class=\"pre\">environ['paste.command_request']</span></tt> will be set to True in the request, so your application can distinguish these calls from normal requests.</p>\n<p>Note that you can pass options besides the options listed here; any unknown options will be passed to the application in <tt class=\"docutils literal\"><span class=\"pre\">environ['QUERY_STRING']</span></tt>.</p>\n<div class=\"highlight\"><pre>Options:\n  -h, --help            show this help message and exit\n  -v, --verbose\n  -q, --quiet\n  -n NAME, --app-name=NAME\n                        Load the named application (default main)\n  --config-var=NAME:VALUE\n                        Variable to make available in the config for %()s\n                        substitution (you can use this option multiple times)\n  --header=NAME:VALUE   Header to add to request (you can use this option\n                        multiple times)\n  --display-headers     Display headers before the response body\n</pre></div>\n</div>\n<div class=\"section\" id=\"future-development\">\n<h3>Future development<a class=\"headerlink\" href=\"#future-development\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>A Pylons controller that handled some of this would probably be quite\nuseful.  Probably even nicer with additions to the current template, so\nthat <tt class=\"docutils literal\"><span class=\"pre\">/.command/</span></tt> all gets routed to a single controller that uses actions\nfor the various sub-commands, and can provide a useful response to\n<tt class=\"docutils literal\"><span class=\"pre\">/.command/?-h</span></tt>, etc.</p>\n</div>\n</div>\n</div>\n", 
   "current_page_name": "advanced_pylons/paster_commands", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 1245410d1f0f8014d3778499f1968612
-ETag: 1131064657
+ETag: 1760990219
 
 {
   "_id": "1245410d1f0f8014d3778499f1968612", 
-  "_rev": "1131064657", 
+  "_rev": "1760990219", 
   "body": "<div class=\"section\" id=\"module-pylons.controllers\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">pylons.controllers</span></tt> &#8211; Controllers<a class=\"headerlink\" href=\"#module-pylons.controllers\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<p>This module makes available the\n<a title=\"pylons.controllers.core.WSGIController\" class=\"reference external\" href=\"../controllers_core/#pylons.controllers.core.WSGIController\"><tt class=\"xref docutils literal\"><span class=\"pre\">WSGIController</span></tt></a> and\n<a title=\"pylons.controllers.xmlrpc.XMLRPCController\" class=\"reference external\" href=\"../controllers_xmlrpc/#pylons.controllers.xmlrpc.XMLRPCController\"><tt class=\"xref docutils literal\"><span class=\"pre\">XMLRPCController</span></tt></a> for easier importing.</p>\n</div>\n", 
   "current_page_name": "modules/controllers", 
   "display_toc": false, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 15b1e0079bed521e98e8ef3bf2ee1ec1
-ETag: 4255680632
+ETag: 3280712779
 
 {
   "_id": "15b1e0079bed521e98e8ef3bf2ee1ec1", 
-  "_rev": "4255680632", 
+  "_rev": "3280712779", 
   "body": "<div class=\"section\" id=\"id1\">\n<span id=\"flickr-search-tutorial\"></span><h1>Flickr search tutorial<a class=\"headerlink\" href=\"#id1\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"introduction\">\n<h2>Introduction<a class=\"headerlink\" href=\"#introduction\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>By now you may have seen the <a class=\"reference external\" href=\"http://media.rubyonrails.org/video/flickr-rails-ajax.mov\">amazing screencast</a> where someone implements a beautiful web interface to <a class=\"reference external\" href=\"http://www.flickr.com\">Flickr!</a> (an online photo gallery) in under 5 minutes. Well if you haven&#8217;t seen it yet, you really should do so now. But if you have you would probably be glad to know that this is possible under Pylons too!</p>\n</div>\n<div class=\"section\" id=\"getting-started\">\n<h2>Getting Started<a class=\"headerlink\" href=\"#getting-started\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>First install Pylons 0.9.6:</p>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span>easy_install -U <span class=\"nv\">pylons</span><span class=\"o\">==</span>0.9.6\n</pre></div>\n<p>Then create your project:</p>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span>paster create -t pylons FlickrSearch\n</pre></div>\n<p>add a controller called <tt class=\"docutils literal\"><span class=\"pre\">flickr</span></tt>:</p>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span><span class=\"nb\">cd </span>FlickrSearch\n<span class=\"nv\">$ </span>paster controller flickr\n</pre></div>\n<p>Our project is going to use a third party library for Flickr web services. We&#8217;ve picked flickr.py from the <a class=\"reference external\" href=\"http://www.flickr.com/services/api/\">Flickr! API list</a>. All third party libraries you add to a Pylons project can go in the <tt class=\"docutils literal\"><span class=\"pre\">lib</span></tt> directory so download <a class=\"reference external\" href=\"http://flickrpy.googlecode.com/svn/trunk/flickr.py\">http://flickrpy.googlecode.com/svn/trunk/flickr.py</a> and put it in <tt class=\"docutils literal\"><span class=\"pre\">lib</span></tt>:</p>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span><span class=\"nb\">cd </span>flickrsearch/lib\n<span class=\"nv\">$ </span>wget http://flickrpy.googlecode.com/svn/trunk/flickr.py\n</pre></div>\n<p>Now lets start the server and see what we have:</p>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span><span class=\"nb\">cd</span> ../../\n<span class=\"nv\">$ </span>paster serve --reload development.ini\n</pre></div>\n<p>Note that we have started the server with the <tt class=\"docutils literal\"><span class=\"pre\">--reload</span></tt> switch. This means any changes we make to code will cause the server to restart if necessary so that you can always test your latest code.</p>\n</div>\n<div class=\"section\" id=\"flickr-api-key\">\n<h2>Flickr API Key<a class=\"headerlink\" href=\"#flickr-api-key\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>To access Flickr! we need a Flickr! API key. You can <a class=\"reference external\" href=\"http://www.flickr.com/services/api/key.gne\">get your API key here</a> after filling in a very short form.</p>\n</div>\n<div class=\"section\" id=\"setup-the-javascripts-and-autohandler\">\n<h2>Setup the JavaScripts and autohandler<a class=\"headerlink\" href=\"#setup-the-javascripts-and-autohandler\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>If you look at <tt class=\"docutils literal\"><span class=\"pre\">config/middleware.py</span></tt> you will see these lines:</p>\n<div class=\"highlight\"><pre><span class=\"n\">javascripts_app</span> <span class=\"o\">=</span> <span class=\"n\">StaticJavascripts</span><span class=\"p\">()</span>\n<span class=\"o\">...</span>\n<span class=\"n\">app</span> <span class=\"o\">=</span> <span class=\"n\">Cascade</span><span class=\"p\">([</span><span class=\"n\">static_app</span><span class=\"p\">,</span> <span class=\"n\">javascripts_app</span><span class=\"p\">,</span> <span class=\"n\">app</span><span class=\"p\">])</span>\n</pre></div>\n<p>The <tt class=\"docutils literal\"><span class=\"pre\">javascripts_app</span></tt> WSGI application maps any requests to <tt class=\"docutils literal\"><span class=\"pre\">/javascripts/</span></tt> straight to the relevant JavaScript in the WebHelpers package. This means you don&#8217;t have to manually copy the Pylons JavaScript files to your project and that if you upgrade Pylons, you will automatically be using the latest scripts.</p>\n<p>Knowing that we don&#8217;t need to worry about JavaScript files, edit the file <tt class=\"docutils literal\"><span class=\"pre\">templates/base.mako</span></tt> with the following content:</p>\n<div class=\"highlight\"><pre><span class=\"cp\">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;</span>\n<span class=\"cp\">&quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span>\n<span class=\"nt\">&lt;html&gt;</span>\n<span class=\"nt\">&lt;head&gt;</span>\n<span class=\"nt\">&lt;title&gt;</span>Flickr!<span class=\"nt\">&lt;/title&gt;</span>\n<span class=\"cp\">${</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">javascript_include_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;/javascripts/effects.js&#39;</span><span class=\"p\">,</span> <span class=\"n\">builtins</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">)</span><span class=\"cp\">}</span>\n<span class=\"cp\">${</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">stylesheet_link_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;/flickr.css&#39;</span><span class=\"p\">)</span><span class=\"cp\">}</span>\n<span class=\"nt\">&lt;/head&gt;</span>\n<span class=\"nt\">&lt;body&gt;</span>\n<span class=\"cp\">${</span><span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">body</span><span class=\"p\">()</span><span class=\"cp\">}</span>\n<span class=\"nt\">&lt;/body&gt;</span>\n<span class=\"nt\">&lt;/html&gt;</span>\n</pre></div>\n<p>If you are interested in learning some of the features of Mako templates have a look at the comprehensive <a class=\"reference external\" href=\"http://www.makotemplates.org/docs/\">Mako Documentation</a>. For now we just need to understand that <tt class=\"docutils literal\"><span class=\"pre\">${self.body()}</span></tt> is replaced with the child template and that anything in <tt class=\"docutils literal\"><span class=\"pre\">${</span> <span class=\"pre\">...</span> <span class=\"pre\">}</span></tt> is executed and replaced with the result. In the head of the HTML document, javaScript and stylesheet tags are inserted.</p>\n</div>\n<div class=\"section\" id=\"write-the-controller-and-templates\">\n<h2>Write The Controller and Templates<a class=\"headerlink\" href=\"#write-the-controller-and-templates\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Add the following to your <tt class=\"docutils literal\"><span class=\"pre\">controllers/flickr.py</span></tt>:</p>\n<div class=\"highlight\"><pre><span class=\"k\">import</span> <span class=\"nn\">logging</span>\n\n<span class=\"k\">from</span> <span class=\"nn\">flickrsearch.lib.base</span> <span class=\"k\">import</span> <span class=\"o\">*</span>\n<span class=\"k\">import</span> <span class=\"nn\">flickrsearch.lib.flickr</span> <span class=\"k\">as</span> <span class=\"nn\">flickr</span>\n\n<span class=\"n\">log</span> <span class=\"o\">=</span> <span class=\"n\">logging</span><span class=\"o\">.</span><span class=\"n\">getLogger</span><span class=\"p\">(</span><span class=\"n\">__name__</span><span class=\"p\">)</span>\n\n<span class=\"n\">flickr</span><span class=\"o\">.</span><span class=\"n\">API_KEY</span> <span class=\"o\">=</span> <span class=\"s\">&quot;Your key here!&quot;</span>\n\n<span class=\"k\">class</span> <span class=\"nc\">FlickrController</span><span class=\"p\">(</span><span class=\"n\">BaseController</span><span class=\"p\">):</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">index</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/flickr.mako&#39;</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">search</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"n\">photos</span> <span class=\"o\">=</span> <span class=\"n\">flickr</span><span class=\"o\">.</span><span class=\"n\">photos_search</span><span class=\"p\">(</span><span class=\"n\">tags</span><span class=\"o\">=</span><span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;tags&#39;</span><span class=\"p\">],</span> <span class=\"n\">per_page</span><span class=\"o\">=</span><span class=\"mf\">24</span><span class=\"p\">)</span>\n        <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">photos</span> <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"n\">photo</span><span class=\"o\">.</span><span class=\"n\">getURL</span><span class=\"p\">(</span><span class=\"n\">size</span><span class=\"o\">=</span><span class=\"s\">&quot;Small&quot;</span><span class=\"p\">,</span> <span class=\"n\">urlType</span><span class=\"o\">=</span><span class=\"s\">&#39;source&#39;</span><span class=\"p\">)</span> <span class=\"k\">for</span> <span class=\"n\">photo</span> <span class=\"ow\">in</span> <span class=\"n\">photos</span><span class=\"p\">]</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/photos.mako&#39;</span><span class=\"p\">)</span>\n</pre></div>\n<p>It should be pretty straight forward, we import the <tt class=\"docutils literal\"><span class=\"pre\">flickr</span></tt> API module, set the API_KEY. And define two actions in our controller. The first <tt class=\"docutils literal\"><span class=\"pre\">index()</span></tt> just renders <tt class=\"docutils literal\"><span class=\"pre\">flickr.mako</span></tt>, the other <tt class=\"docutils literal\"><span class=\"pre\">search()</span></tt> uses the <tt class=\"docutils literal\"><span class=\"pre\">flickr</span></tt> API module to select all photos by using the tag from <tt class=\"docutils literal\"><span class=\"pre\">request.params['tags']</span></tt>. <tt class=\"docutils literal\"><span class=\"pre\">request.params</span></tt> are given to this action by the form from <tt class=\"docutils literal\"><span class=\"pre\">templates/flickr.mako</span></tt> with a POST method. It then renders the <tt class=\"docutils literal\"><span class=\"pre\">templates/photos.mako</span></tt> template by calling the Pylons <tt class=\"docutils literal\"><span class=\"pre\">render()</span></tt> function.</p>\n<p>Time to create the two templates. Create <tt class=\"docutils literal\"><span class=\"pre\">templates/flickr.mako</span></tt> with this content:</p>\n<div class=\"highlight\"><pre><span class=\"cp\">&lt;%</span><span class=\"nb\">inherit</span> <span class=\"na\">file=</span><span class=\"s\">&quot;base.mako&quot;</span><span class=\"cp\">/&gt;</span>\n<span class=\"cp\">${</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">form_remote_tag</span><span class=\"p\">(</span><span class=\"n\">url</span><span class=\"o\">=</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">url</span><span class=\"p\">(</span><span class=\"n\">action</span><span class=\"o\">=</span><span class=\"s\">&quot;search&quot;</span><span class=\"p\">),</span> <span class=\"n\">update</span><span class=\"o\">=</span><span class=\"s\">&quot;photos&quot;</span><span class=\"p\">,</span>\n<span class=\"n\">complete</span><span class=\"o\">=</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">visual_effect</span><span class=\"p\">(</span><span class=\"s\">&quot;Blind_down&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;photos&quot;</span><span class=\"p\">),</span>\n<span class=\"n\">loading</span><span class=\"o\">=</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">update_element_function</span><span class=\"p\">(</span><span class=\"s\">&quot;spinner&quot;</span><span class=\"p\">,</span>\n<span class=\"n\">content</span><span class=\"o\">=</span><span class=\"s\">&quot;loading..&quot;</span><span class=\"p\">),</span>\n<span class=\"n\">loaded</span><span class=\"o\">=</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">update_element_function</span><span class=\"p\">(</span><span class=\"s\">&quot;spinner&quot;</span><span class=\"p\">,</span> <span class=\"n\">content</span><span class=\"o\">=</span><span class=\"s\">&quot;&quot;</span><span class=\"p\">))</span><span class=\"cp\">}</span>\n<span class=\"nt\">&lt;div</span> <span class=\"na\">id=</span><span class=\"s\">&quot;spinner&quot;</span><span class=\"nt\">&gt;&lt;/div&gt;</span>\n<span class=\"nt\">&lt;fieldset&gt;</span>\n<span class=\"nt\">&lt;label</span> <span class=\"na\">for=</span><span class=\"s\">&quot;tags&quot;</span><span class=\"nt\">&gt;</span>Tags:<span class=\"nt\">&lt;/label&gt;</span>\n<span class=\"cp\">${</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">text_field</span><span class=\"p\">(</span><span class=\"s\">&quot;tags&quot;</span><span class=\"p\">)</span><span class=\"cp\">}</span>\n<span class=\"cp\">${</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">submit</span><span class=\"p\">(</span><span class=\"s\">&quot;Find&quot;</span><span class=\"p\">)</span><span class=\"cp\">}</span>\n<span class=\"nt\">&lt;/fieldset&gt;</span>\n<span class=\"nt\">&lt;div</span> <span class=\"na\">id=</span><span class=\"s\">&quot;photos&quot;</span> <span class=\"na\">style=</span><span class=\"s\">&quot;display:none&quot;</span><span class=\"nt\">&gt;&lt;/div&gt;</span>\n<span class=\"cp\">${</span><span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">end_form</span><span class=\"p\">()</span><span class=\"cp\">}</span>\n</pre></div>\n<p>Create <tt class=\"docutils literal\"><span class=\"pre\">templates/photos.mako</span></tt> with this content:</p>\n<div class=\"highlight\"><pre><span class=\"cp\">%</span> <span class=\"k\">for</span> <span class=\"n\">photo</span> <span class=\"ow\">in</span> <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">photos</span><span class=\"p\">:</span>\n<span class=\"nt\">&lt;img</span> <span class=\"na\">class=</span><span class=\"s\">&quot;photo&quot;</span> <span class=\"na\">src=</span><span class=\"s\">&quot;</span><span class=\"cp\">${</span><span class=\"n\">photo</span><span class=\"cp\">}</span><span class=\"s\">&quot;</span><span class=\"nt\">&gt;</span>\n<span class=\"cp\">%</span><span class=\"k\"> endfor</span>\n</pre></div>\n</div>\n<div class=\"section\" id=\"add-some-style\">\n<h2>Add Some Style<a class=\"headerlink\" href=\"#add-some-style\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Finally we need to add some style to our project so create the stylesheet <tt class=\"docutils literal\"><span class=\"pre\">public/flickr.css</span></tt>. We are going to use the same stylesheet as the Rails example:</p>\n<div class=\"highlight\"><pre><span class=\"nt\">body</span> <span class=\"p\">{</span>\n<span class=\"k\">background-color</span><span class=\"o\">:</span> <span class=\"m\">#888</span><span class=\"p\">;</span>\n<span class=\"k\">font-family</span><span class=\"o\">:</span> <span class=\"n\">Lucida</span> <span class=\"n\">Grande</span><span class=\"p\">;</span>\n<span class=\"k\">font-size</span><span class=\"o\">:</span> <span class=\"m\">11px</span><span class=\"p\">;</span>\n<span class=\"k\">margin</span><span class=\"o\">:</span> <span class=\"m\">25px</span><span class=\"p\">;</span>\n<span class=\"p\">}</span>\n<span class=\"nt\">form</span> <span class=\"p\">{</span>\n<span class=\"k\">margin</span><span class=\"o\">:</span> <span class=\"m\">0</span><span class=\"p\">;</span>\n<span class=\"k\">margin-bottom</span><span class=\"o\">:</span> <span class=\"m\">10px</span><span class=\"p\">;</span>\n<span class=\"k\">background-color</span><span class=\"o\">:</span> <span class=\"m\">#eee</span><span class=\"p\">;</span>\n<span class=\"k\">border</span><span class=\"o\">:</span> <span class=\"m\">5px</span> <span class=\"k\">solid</span> <span class=\"m\">#333</span><span class=\"p\">;</span>\n<span class=\"k\">padding</span><span class=\"o\">:</span> <span class=\"m\">25px</span><span class=\"p\">;</span>\n<span class=\"p\">}</span>\n<span class=\"nt\">fieldset</span> <span class=\"p\">{</span>\n<span class=\"k\">border</span><span class=\"o\">:</span> <span class=\"k\">none</span><span class=\"p\">;</span>\n<span class=\"p\">}</span>\n<span class=\"nf\">#spinner</span> <span class=\"p\">{</span>\n<span class=\"k\">float</span><span class=\"o\">:</span> <span class=\"k\">right</span><span class=\"p\">;</span>\n<span class=\"k\">margin</span><span class=\"o\">:</span> <span class=\"m\">10px</span><span class=\"p\">;</span>\n<span class=\"p\">}</span>\n<span class=\"nf\">#photos</span> <span class=\"nt\">img</span> <span class=\"p\">{</span>\n<span class=\"k\">border</span><span class=\"o\">:</span> <span class=\"m\">1px</span> <span class=\"k\">solid</span> <span class=\"m\">#000</span><span class=\"p\">;</span>\n<span class=\"k\">width</span><span class=\"o\">:</span> <span class=\"m\">75px</span><span class=\"p\">;</span>\n<span class=\"k\">height</span><span class=\"o\">:</span> <span class=\"m\">75px</span><span class=\"p\">;</span>\n<span class=\"k\">margin</span><span class=\"o\">:</span> <span class=\"m\">5px</span><span class=\"p\">;</span>\n<span class=\"p\">}</span>\n</pre></div>\n</div>\n<div class=\"section\" id=\"quick-recap\">\n<h2>Quick Recap<a class=\"headerlink\" href=\"#quick-recap\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<blockquote>\n<ul class=\"simple\">\n<li>Installed a Flickr library</li>\n<li>Written a controller with <tt class=\"docutils literal\"><span class=\"pre\">index()</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">search()</span></tt> methods</li>\n<li>Written a main template linking to the JavaScripts we need</li>\n<li>Created a template fragment to generate HTML to return to the browser via AJAX</li>\n<li>Added the necessary CSS</li>\n</ul>\n</blockquote>\n<p>We are done! OK visit <a class=\"reference external\" href=\"http://127.0.0.1:5000/flickr\">http://127.0.0.1:5000/flickr</a> and check your stopwatch. How long did it take you?</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">If you have any problems ensure you have set the <tt class=\"docutils literal\"><span class=\"pre\">flickr.API_KEY</span></tt> in <tt class=\"docutils literal\"><span class=\"pre\">controllers/flickr</span></tt> and have a look at the console output from <tt class=\"docutils literal\"><span class=\"pre\">paster</span> <span class=\"pre\">serve</span></tt>. If there are any debug URLs logged you can visit those URLs to get an interactive debug prompt and work out where you went wrong!</p>\n</div>\n<p>Based on <a class=\"reference external\" href=\"http://pylonshq.com/project/pylonshq/wiki/RailsFlickrExample\">original tutorial for Pylons 0.8 by Nicholas Piel</a></p>\n</div>\n</div>\n", 
   "current_page_name": "tutorials/flickr_search_tutorial", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 1877fe376deba7a2cdcbed5aff30544c
-ETag: 3729509796
+ETag: 2507793094
 
 {
   "_id": "1877fe376deba7a2cdcbed5aff30544c", 
-  "_rev": "3729509796", 
+  "_rev": "2507793094", 
   "body": "<div class=\"section\" id=\"rails-webhelpers-rails-deprecated\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">rails</span></tt> WebHelpers Rails <em>(deprecated)</em><a class=\"headerlink\" href=\"#rails-webhelpers-rails-deprecated\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Deprecated in 0.6</p>\n</div>\n<div class=\"section\" id=\"asset-tag\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">asset_tag</span></tt><a class=\"headerlink\" href=\"#asset-tag\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.asset_tag.auto_discovery_link_tag\">\n<!--[webhelpers.rails.asset_tag.auto_discovery_link_tag]--><tt class=\"descclassname\">webhelpers.rails.asset_tag.</tt><tt class=\"descname\">auto_discovery_link_tag</tt><big>(</big><em>source</em>, <em>type='rss'</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.asset_tag.auto_discovery_link_tag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return a link tag allowing auto-detecting of RSS or ATOM feed.</p>\n<p>The auto-detection of feed for the current page is only for browsers\nand news readers that support it.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">source</span></tt></dt>\n<dd>The URL of the feed. The URL is ultimately prepended with the \nenvironment&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">SCRIPT_NAME</span></tt> (the root path of the web \napplication), unless the URL is fully-fledged \n(e.g. <a class=\"reference external\" href=\"http://example.com\">http://example.com</a>).</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">type</span></tt></dt>\n<dd>The type of feed. Specifying &#8216;rss&#8217; or &#8216;atom&#8217; automatically \ntranslates to a type of &#8216;application/rss+xml&#8217; or \n&#8216;application/atom+xml&#8217;, respectively. Otherwise the type is used \nas specified. Defaults to &#8216;rss&#8217;.</dd>\n</dl>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">auto_discovery_link_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;http://feed.com/feed.xml&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;link href=&quot;http://feed.com/feed.xml&quot; rel=&quot;alternate&quot; title=&quot;RSS&quot; type=&quot;application/rss+xml&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">auto_discovery_link_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;http://feed.com/feed.xml&#39;</span><span class=\"p\">,</span> <span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;atom&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;link href=&quot;http://feed.com/feed.xml&quot; rel=&quot;alternate&quot; title=&quot;ATOM&quot; type=&quot;application/atom+xml&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">auto_discovery_link_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;app.rss&#39;</span><span class=\"p\">,</span> <span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;atom&#39;</span><span class=\"p\">,</span> <span class=\"n\">title</span><span class=\"o\">=</span><span class=\"s\">&#39;atom feed&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;link href=&quot;app.rss&quot; rel=&quot;alternate&quot; title=&quot;atom feed&quot; type=&quot;application/atom+xml&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">auto_discovery_link_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;/app.html&#39;</span><span class=\"p\">,</span> <span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;text/html&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;link href=&quot;/app.html&quot; rel=&quot;alternate&quot; title=&quot;&quot; type=&quot;text/html&quot; /&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.asset_tag.image_tag\">\n<!--[webhelpers.rails.asset_tag.image_tag]--><tt class=\"descclassname\">webhelpers.rails.asset_tag.</tt><tt class=\"descname\">image_tag</tt><big>(</big><em>source</em>, <em>alt=None</em>, <em>size=None</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.asset_tag.image_tag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return an image tag for the specified <tt class=\"docutils literal\"><span class=\"pre\">source</span></tt>.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">source</span></tt></dt>\n<dd>The source URL of the image. The URL is prepended with &#8216;/images/&#8217;, \nunless its full path is specified. The URL is ultimately \nprepended with the environment&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">SCRIPT_NAME</span></tt> (the root path \nof the web application), unless the URL is fully-fledged (e.g. \n<a class=\"reference external\" href=\"http://example.com\">http://example.com</a>).</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">alt</span></tt></dt>\n<dd>The img&#8217;s alt tag. Defaults to the source&#8217;s filename, title cased.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">size</span></tt></dt>\n<dd>The img&#8217;s size, specified in the format &#8220;XxY&#8221;. &#8220;30x45&#8221; becomes\nwidth=&#8221;30&#8221;, height=&#8221;45&#8221;. &#8220;x20&#8221; becomes height=&#8221;20&#8221;.</dd>\n</dl>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">image_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;xml.png&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;img alt=&quot;Xml&quot; src=&quot;/images/xml.png&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">image_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;rss.png&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;rss syndication&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;img alt=&quot;rss syndication&quot; src=&quot;/images/rss.png&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">image_tag</span><span class=\"p\">(</span><span class=\"s\">&quot;icon.png&quot;</span><span class=\"p\">,</span> <span class=\"n\">size</span><span class=\"o\">=</span><span class=\"s\">&quot;16x10&quot;</span><span class=\"p\">,</span> <span class=\"n\">alt</span><span class=\"o\">=</span><span class=\"s\">&quot;Edit Entry&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;img alt=&quot;Edit Entry&quot; height=&quot;10&quot; src=&quot;/images/icon.png&quot; width=&quot;16&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">image_tag</span><span class=\"p\">(</span><span class=\"s\">&quot;/icons/icon.gif&quot;</span><span class=\"p\">,</span> <span class=\"n\">size</span><span class=\"o\">=</span><span class=\"s\">&quot;16x16&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;img alt=&quot;Icon&quot; height=&quot;16&quot; src=&quot;/icons/icon.gif&quot; width=&quot;16&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">image_tag</span><span class=\"p\">(</span><span class=\"s\">&quot;/icons/icon.gif&quot;</span><span class=\"p\">,</span> <span class=\"n\">size</span><span class=\"o\">=</span><span class=\"s\">&quot;16x&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;img alt=&quot;Icon&quot; src=&quot;/icons/icon.gif&quot; width=&quot;16&quot; /&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.asset_tag.javascript_include_tag\">\n<!--[webhelpers.rails.asset_tag.javascript_include_tag]--><tt class=\"descclassname\">webhelpers.rails.asset_tag.</tt><tt class=\"descname\">javascript_include_tag</tt><big>(</big><em>*sources</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.asset_tag.javascript_include_tag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return script include tags for the specified javascript <tt class=\"docutils literal\"><span class=\"pre\">sources</span></tt>.</p>\n<p>Each source&#8217;s URL path is prepended with &#8216;/javascripts/&#8217; unless \ntheir full path is specified. Each source&#8217;s URL path is ultimately \nprepended with the environment&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">SCRIPT_NAME</span></tt> (the root path of \nthe web application), unless the URL path is a full-fledged URL \n(e.g. <a class=\"reference external\" href=\"http://example.com\">http://example.com</a>). Sources with no filename extension will \nbe appended with the &#8216;.js&#8217; extension.</p>\n<p>Optionally includes (prepended) WebHelpers&#8217; built-in javascripts \nwhen passed the <tt class=\"docutils literal\"><span class=\"pre\">builtins=True</span></tt> keyword argument.</p>\n<p>Specify the keyword argument <tt class=\"docutils literal\"><span class=\"pre\">defer=True</span></tt> to enable the script \ndefer attribute.</p>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">print</span> <span class=\"n\">javascript_include_tag</span><span class=\"p\">(</span><span class=\"n\">builtins</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">)</span>\n<span class=\"go\">&lt;script src=&quot;/javascripts/prototype.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n<span class=\"go\">&lt;script src=&quot;/javascripts/scriptaculous.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">print</span> <span class=\"n\">javascript_include_tag</span><span class=\"p\">(</span><span class=\"n\">builtins</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">,</span> <span class=\"n\">defer</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">)</span>\n<span class=\"go\">&lt;script defer=&quot;defer&quot; src=&quot;/javascripts/prototype.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n<span class=\"go\">&lt;script defer=&quot;defer&quot; src=&quot;/javascripts/scriptaculous.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">print</span> <span class=\"n\">javascript_include_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;prototype&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;/other-javascripts/util.js&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&lt;script src=&quot;/javascripts/prototype.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n<span class=\"go\">&lt;script src=&quot;/other-javascripts/util.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">print</span> <span class=\"n\">javascript_include_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;app&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;/test/test.1.js&#39;</span><span class=\"p\">,</span> <span class=\"n\">builtins</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">)</span>\n<span class=\"go\">&lt;script src=&quot;/javascripts/prototype.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n<span class=\"go\">&lt;script src=&quot;/javascripts/scriptaculous.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n<span class=\"go\">&lt;script src=&quot;/javascripts/app.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n<span class=\"go\">&lt;script src=&quot;/test/test.1.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.asset_tag.stylesheet_link_tag\">\n<!--[webhelpers.rails.asset_tag.stylesheet_link_tag]--><tt class=\"descclassname\">webhelpers.rails.asset_tag.</tt><tt class=\"descname\">stylesheet_link_tag</tt><big>(</big><em>*sources</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.asset_tag.stylesheet_link_tag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return CSS link tags for the specified stylesheet <tt class=\"docutils literal\"><span class=\"pre\">sources</span></tt>.</p>\n<p>Each source&#8217;s URL path is prepended with &#8216;/stylesheets/&#8217; unless \ntheir full path is specified. Each source&#8217;s URL path is ultimately \nprepended with the environment&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">SCRIPT_NAME</span></tt> (the root path of \nthe web application), unless the URL path is a full-fledged URL \n(e.g., <a class=\"reference external\" href=\"http://example.com\">http://example.com</a>). Sources with no filename extension will \nbe appended with the &#8216;.css&#8217; extension.</p>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stylesheet_link_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;style&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;link href=&quot;/stylesheets/style.css&quot; media=&quot;screen&quot; rel=&quot;Stylesheet&quot; type=&quot;text/css&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stylesheet_link_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;dir/file&#39;</span><span class=\"p\">,</span> <span class=\"n\">media</span><span class=\"o\">=</span><span class=\"s\">&#39;all&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;link href=&quot;/stylesheets/dir/file.css&quot; media=&quot;all&quot; rel=&quot;Stylesheet&quot; type=&quot;text/css&quot; /&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stylesheet_link_tag</span><span class=\"p\">(</span><span class=\"s\">&#39;/dir/file&#39;</span><span class=\"p\">,</span> <span class=\"n\">media</span><span class=\"o\">=</span><span class=\"s\">&#39;all&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;link href=&quot;/dir/file.css&quot; media=&quot;all&quot; rel=&quot;Stylesheet&quot; type=&quot;text/css&quot; /&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.asset_tag.compute_public_path\">\n<!--[webhelpers.rails.asset_tag.compute_public_path]--><tt class=\"descclassname\">webhelpers.rails.asset_tag.</tt><tt class=\"descname\">compute_public_path</tt><big>(</big><em>source</em>, <em>root_path=None</em>, <em>ext=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.asset_tag.compute_public_path\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format the specified source for publishing.</p>\n<p>Use the public directory, if applicable.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.asset_tag.get_script_name\">\n<!--[webhelpers.rails.asset_tag.get_script_name]--><tt class=\"descclassname\">webhelpers.rails.asset_tag.</tt><tt class=\"descname\">get_script_name</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.asset_tag.get_script_name\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Determine the current web application&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">SCRIPT_NAME</span></tt>.</dd></dl>\n\n</div>\n<div class=\"section\" id=\"date\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">date</span></tt><a class=\"headerlink\" href=\"#date\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.date.distance_of_time_in_words\">\n<!--[webhelpers.rails.date.distance_of_time_in_words]--><tt class=\"descclassname\">webhelpers.rails.date.</tt><tt class=\"descname\">distance_of_time_in_words</tt><big>(</big><em>from_time</em>, <em>to_time=0</em>, <em>include_seconds=False</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.date.distance_of_time_in_words\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return approximate-time-distance string for two datetimes or ints.</p>\n<p>If times are integers, they are interpreted as seconds.</p>\n<p>Set <tt class=\"docutils literal\"><span class=\"pre\">include_seconds</span></tt> to True for more more detailed approximations \nwhen distance &lt; 1 min, 29 secs</p>\n<p>Distances are reported based on the following table:</p>\n<p>0 &lt;-&gt; 29 secs                                   =&gt; less than a minute\n30 secs &lt;-&gt; 1 min, 29 secs                      =&gt; 1 minute\n1 min, 30 secs &lt;-&gt; 44 mins, 29 secs             =&gt; [2..44] minutes\n44 mins, 30 secs &lt;-&gt; 89 mins, 29 secs           =&gt; about 1 hour\n89 mins, 30 secs &lt;-&gt; 1 day minus 31 secs        =&gt; about [2..24] hours\n1 day minus 30 secs &lt;-&gt; 2 days minus 31 secs    =&gt; 1 day\n2 days minus 30 secs &lt;-&gt; 30 days minus 31 secs  =&gt; [2..29] days\n30 days minus 30 secs &lt;-&gt; 60 days minus 31 secs =&gt; about 1 month\n60 days minus 30 secs &lt;-&gt; 1 yr minus 31 secs    =&gt; [2..12] months\n1 yr minus 30 secs &lt;-&gt; 2 yrs minus 31 secs      =&gt; about 1 year\n2 yrs minus 30 secs &lt;-&gt; max time or date        =&gt; over [2..X] years</p>\n<p>With <tt class=\"docutils literal\"><span class=\"pre\">include_seconds</span></tt> set to True and the difference &lt; 1 minute 29\nseconds:</p>\n<p>0-4   secs    =&gt; less than 5 seconds\n5-9   secs    =&gt; less than 10 seconds\n10-19 secs    =&gt; less than 20 seconds\n20-39 secs    =&gt; half a minute\n40-59 secs    =&gt; less than a minute\n60-89 secs    =&gt; 1 minute</p>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">from</span> <span class=\"nn\">datetime</span> <span class=\"k\">import</span> <span class=\"n\">datetime</span><span class=\"p\">,</span> <span class=\"n\">timedelta</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">from_time</span> <span class=\"o\">=</span> <span class=\"n\">datetime</span><span class=\"o\">.</span><span class=\"n\">now</span><span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">distance_of_time_in_words</span><span class=\"p\">(</span><span class=\"n\">from_time</span><span class=\"p\">,</span> <span class=\"n\">from_time</span> <span class=\"o\">+</span> <span class=\"n\">timedelta</span><span class=\"p\">(</span><span class=\"n\">minutes</span><span class=\"o\">=</span><span class=\"mf\">50</span><span class=\"p\">))</span>\n<span class=\"go\">&#39;about 1 hour&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">distance_of_time_in_words</span><span class=\"p\">(</span><span class=\"n\">from_time</span><span class=\"p\">,</span> <span class=\"n\">from_time</span> <span class=\"o\">+</span> <span class=\"n\">timedelta</span><span class=\"p\">(</span><span class=\"n\">seconds</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">))</span>\n<span class=\"go\">&#39;less than a minute&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">distance_of_time_in_words</span><span class=\"p\">(</span><span class=\"n\">from_time</span><span class=\"p\">,</span> <span class=\"n\">from_time</span> <span class=\"o\">+</span> <span class=\"n\">timedelta</span><span class=\"p\">(</span><span class=\"n\">seconds</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">),</span> <span class=\"n\">include_seconds</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;less than 20 seconds&#39;</span>\n</pre></div>\n<p>Note: <tt class=\"docutils literal\"><span class=\"pre\">distance_of_time_in_words</span></tt> calculates one year as 365.25 days.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.date.time_ago_in_words\">\n<!--[webhelpers.rails.date.time_ago_in_words]--><tt class=\"descclassname\">webhelpers.rails.date.</tt><tt class=\"descname\">time_ago_in_words</tt><big>(</big><em>from_time</em>, <em>include_seconds=False</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.date.time_ago_in_words\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return approximate-time-distance string for <tt class=\"docutils literal\"><span class=\"pre\">from_time</span></tt> til now.</p>\n<p>See <tt class=\"docutils literal\"><span class=\"pre\">distance_of_time_in_words</span></tt> &#8211; same here, but <tt class=\"docutils literal\"><span class=\"pre\">to_time</span></tt> is \nfixed to <tt class=\"docutils literal\"><span class=\"pre\">datetime.now()</span></tt>.</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"form-options\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">form_options</span></tt><a class=\"headerlink\" href=\"#form-options\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_options.options_for_select\">\n<!--[webhelpers.rails.form_options.options_for_select]--><tt class=\"descclassname\">webhelpers.rails.form_options.</tt><tt class=\"descname\">options_for_select</tt><big>(</big><em>container</em>, <em>selected=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_options.options_for_select\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create select options from a container (list, tuple, dict).</p>\n<p>Accepts a container (list, tuple, dict) and returns a string of \noption tags. Given a container where the elements respond to first \nand last (such as a two-element array), the &#8220;lasts&#8221; serve as option \nvalues and the &#8220;firsts&#8221; as option text. Dicts are turned into this \nform automatically, so the keys become &#8220;firsts&#8221; and values become \nlasts. If <tt class=\"docutils literal\"><span class=\"pre\">selected</span></tt> is specified, the matching &#8220;last&#8221; or element \nwill get the selected option-tag. <tt class=\"docutils literal\"><span class=\"pre\">Selected</span></tt> may also be an array \nof values to be selected when using a multiple select.</p>\n<p>Examples (call, result):</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">options_for_select</span><span class=\"p\">([[</span><span class=\"s\">&quot;Dollar&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;$&quot;</span><span class=\"p\">],</span> <span class=\"p\">[</span><span class=\"s\">&quot;Kroner&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;DKK&quot;</span><span class=\"p\">]])</span>\n<span class=\"go\">&#39;&lt;option value=&quot;$&quot;&gt;Dollar&lt;/option&gt;\\n&lt;option value=&quot;DKK&quot;&gt;Kroner&lt;/option&gt;&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">options_for_select</span><span class=\"p\">([</span> <span class=\"s\">&quot;VISA&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;MasterCard&quot;</span> <span class=\"p\">],</span> <span class=\"s\">&quot;MasterCard&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;option value=&quot;VISA&quot;&gt;VISA&lt;/option&gt;\\n&lt;option value=&quot;MasterCard&quot; selected=&quot;selected&quot;&gt;MasterCard&lt;/option&gt;&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">options_for_select</span><span class=\"p\">(</span><span class=\"nb\">dict</span><span class=\"p\">(</span><span class=\"n\">Basic</span><span class=\"o\">=</span><span class=\"s\">&quot;$20&quot;</span><span class=\"p\">,</span> <span class=\"n\">Plus</span><span class=\"o\">=</span><span class=\"s\">&quot;$40&quot;</span><span class=\"p\">),</span> <span class=\"s\">&quot;$40&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;option value=&quot;$20&quot;&gt;Basic&lt;/option&gt;\\n&lt;option value=&quot;$40&quot; selected=&quot;selected&quot;&gt;Plus&lt;/option&gt;&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">options_for_select</span><span class=\"p\">([</span> <span class=\"s\">&quot;VISA&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;MasterCard&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;Discover&quot;</span> <span class=\"p\">],</span> <span class=\"p\">[</span><span class=\"s\">&quot;VISA&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;Discover&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">&#39;&lt;option value=&quot;VISA&quot; selected=&quot;selected&quot;&gt;VISA&lt;/option&gt;\\n&lt;option value=&quot;MasterCard&quot;&gt;MasterCard&lt;/option&gt;\\n&lt;option value=&quot;Discover&quot; selected=&quot;selected&quot;&gt;Discover&lt;/option&gt;&#39;</span>\n</pre></div>\n<p>Note: Only the option tags are returned.  You have to wrap this call \nin a regular HTML select tag.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_options.options_for_select_from_objects\">\n<!--[webhelpers.rails.form_options.options_for_select_from_objects]--><tt class=\"descclassname\">webhelpers.rails.form_options.</tt><tt class=\"descname\">options_for_select_from_objects</tt><big>(</big><em>container</em>, <em>name_attr</em>, <em>value_attr=None</em>, <em>selected=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_options.options_for_select_from_objects\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create select options from objects in a container.</p>\n<p>Returns a string of option tags that have been compiled by iterating \nover the <tt class=\"docutils literal\"><span class=\"pre\">container</span></tt> and assigning the the result of a call to the \n<tt class=\"docutils literal\"><span class=\"pre\">value_attr</span></tt> as the option value and the <tt class=\"docutils literal\"><span class=\"pre\">name_attr</span></tt> as the \noption text.</p>\n<p>If <tt class=\"docutils literal\"><span class=\"pre\">selected</span></tt> is specified, the element returning a match on \n<tt class=\"docutils literal\"><span class=\"pre\">value_attr</span></tt> will get the selected option tag.</p>\n<p>NOTE: Only the option tags are returned. You have to wrap this call \nin a regular HTML select tag.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_options.options_for_select_from_dicts\">\n<!--[webhelpers.rails.form_options.options_for_select_from_dicts]--><tt class=\"descclassname\">webhelpers.rails.form_options.</tt><tt class=\"descname\">options_for_select_from_dicts</tt><big>(</big><em>container</em>, <em>name_key</em>, <em>value_key=None</em>, <em>selected=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_options.options_for_select_from_dicts\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create select options from dicts in a container.</p>\n<p>Returns a string of option tags that have been compiled by iterating \nover the <tt class=\"docutils literal\"><span class=\"pre\">container</span></tt> and assigning the result of a call to the \n<tt class=\"docutils literal\"><span class=\"pre\">value_key</span></tt> as the option value and the <tt class=\"docutils literal\"><span class=\"pre\">name_attr</span></tt> as the \noption text.</p>\n<p>If <tt class=\"docutils literal\"><span class=\"pre\">selected</span></tt> is specified, the element returning a match on \n<tt class=\"docutils literal\"><span class=\"pre\">value_key</span></tt> will get the selected option tag.</p>\n<p>NOTE: Only the option tags are returned. You have to wrap this call \nin a regular HTML select tag.</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"form-tag\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">form_tag</span></tt><a class=\"headerlink\" href=\"#form-tag\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.form\">\n<!--[webhelpers.rails.form_tag.form]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">form</tt><big>(</big><em>url</em>, <em>method='POST'</em>, <em>multipart=False</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.form\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Start a form tag that points the action to an url.</p>\n<p>The url options should be given either as a string, or as a <tt class=\"docutils literal\"><span class=\"pre\">url()</span></tt>\nfunction. The method for the form defaults to POST.</p>\n<p>Options:</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">multipart</span></tt></dt>\n<dd>If set to True, the enctype is set to &#8220;multipart/form-data&#8221;.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">method</span></tt></dt>\n<dd>The method to use when submitting the form, usually either &#8220;GET&#8221; or \n&#8220;POST&#8221;. If &#8220;PUT&#8221;, &#8220;DELETE&#8221;, or another verb is used, a hidden input\nwith name _method is added to simulate the verb over POST.</dd>\n</dl>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.end_form\">\n<!--[webhelpers.rails.form_tag.end_form]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">end_form</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.end_form\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Output &#8220;&lt;/form&gt;&#8221;.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">end_form</span><span class=\"p\">()</span>\n<span class=\"go\">&#39;&lt;/form&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.select\">\n<!--[webhelpers.rails.form_tag.select]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">select</tt><big>(</big><em>name</em>, <em>option_tags=''</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.select\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a dropdown selection box.</p>\n<p><tt class=\"docutils literal\"><span class=\"pre\">option_tags</span></tt> is a string containing the option tags.</p>\n<p>Options:</p>\n<ul>\n<li><dl class=\"first docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">multiple</span></tt> - If set to True the selection will allow multiple </dt>\n<dd><p class=\"first last\">choices.</p>\n</dd>\n</dl>\n</li>\n</ul>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s\">&quot;people&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;&lt;option&gt;George&lt;/option&gt;&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;select id=&quot;people&quot; name=&quot;people&quot;&gt;&lt;option&gt;George&lt;/option&gt;&lt;/select&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.text_field\">\n<!--[webhelpers.rails.form_tag.text_field]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">text_field</tt><big>(</big><em>name</em>, <em>value=None</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.text_field\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a standard text field.</p>\n<p><tt class=\"docutils literal\"><span class=\"pre\">value</span></tt> is a string, the content of the text field.</p>\n<p>Options:</p>\n<ul>\n<li><dl class=\"first docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">disabled</span></tt> - If set to True, the user will not be able to use </dt>\n<dd><p class=\"first last\">this input.</p>\n</dd>\n</dl>\n</li>\n<li><dl class=\"first docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">size</span></tt> - The number of visible characters that will fit in the </dt>\n<dd><p class=\"first last\">input.</p>\n</dd>\n</dl>\n</li>\n<li><dl class=\"first docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">maxlength</span></tt> - The maximum number of characters that the browser </dt>\n<dd><p class=\"first last\">will allow the user to enter.</p>\n</dd>\n</dl>\n</li>\n</ul>\n<p>Remaining keyword options will be standard HTML options for the tag.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.hidden_field\">\n<!--[webhelpers.rails.form_tag.hidden_field]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">hidden_field</tt><big>(</big><em>name</em>, <em>value=None</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.hidden_field\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a hidden field.</p>\n<p>Takes the same options as text_field.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.file_field\">\n<!--[webhelpers.rails.form_tag.file_field]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">file_field</tt><big>(</big><em>name</em>, <em>value=None</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.file_field\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a file upload field.</p>\n<p>If you are using file uploads then you will also need to set the \nmultipart option for the form.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">file_field</span><span class=\"p\">(</span><span class=\"s\">&#39;myfile&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;input id=&quot;myfile&quot; name=&quot;myfile&quot; type=&quot;file&quot; /&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.password_field\">\n<!--[webhelpers.rails.form_tag.password_field]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">password_field</tt><big>(</big><em>name='password'</em>, <em>value=None</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.password_field\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a password field.</p>\n<p>Takes the same options as text_field.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.text_area\">\n<!--[webhelpers.rails.form_tag.text_area]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">text_area</tt><big>(</big><em>name</em>, <em>content=''</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.text_area\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a text input area.</p>\n<p>Options:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\"><span class=\"pre\">size</span></tt> - A string specifying the dimensions of the textarea.</li>\n</ul>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">text_area</span><span class=\"p\">(</span><span class=\"s\">&quot;body&quot;</span><span class=\"p\">,</span> <span class=\"s\">&#39;&#39;</span><span class=\"p\">,</span> <span class=\"n\">size</span><span class=\"o\">=</span><span class=\"s\">&quot;25x10&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;textarea cols=&quot;25&quot; id=&quot;body&quot; name=&quot;body&quot; rows=&quot;10&quot;&gt;&lt;/textarea&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.check_box\">\n<!--[webhelpers.rails.form_tag.check_box]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">check_box</tt><big>(</big><em>name</em>, <em>value='1'</em>, <em>checked=False</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.check_box\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Create a check box.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.radio_button\">\n<!--[webhelpers.rails.form_tag.radio_button]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">radio_button</tt><big>(</big><em>name</em>, <em>value</em>, <em>checked=False</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.radio_button\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a radio button.</p>\n<p>The id of the radio button will be set to the name + &#8216; &#8216; + value to \nensure its uniqueness.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.form_tag.submit\">\n<!--[webhelpers.rails.form_tag.submit]--><tt class=\"descclassname\">webhelpers.rails.form_tag.</tt><tt class=\"descname\">submit</tt><big>(</big><em>value='Save changes'</em>, <em>name='commit'</em>, <em>confirm=None</em>, <em>disable_with=None</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.form_tag.submit\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a submit button with the text <tt class=\"docutils literal\"><span class=\"pre\">value</span></tt> as the caption.</p>\n<p>Options:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\"><span class=\"pre\">confirm</span></tt> - A confirm message displayed when the button is clicked.</li>\n<li><tt class=\"docutils literal\"><span class=\"pre\">disable_with</span></tt> - The value to be used to rename a disabled version \nof the submit button.</li>\n</ul>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"javascript\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">javascript</span></tt><a class=\"headerlink\" href=\"#javascript\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.javascript.link_to_function\">\n<!--[webhelpers.rails.javascript.link_to_function]--><tt class=\"descclassname\">webhelpers.rails.javascript.</tt><tt class=\"descname\">link_to_function</tt><big>(</big><em>name</em>, <em>function</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.javascript.link_to_function\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return a link that&#8217;ll trigger a JavaScript <tt class=\"docutils literal\"><span class=\"pre\">function</span></tt> using the \nonclick handler and return false after the fact.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"n\">link_to_function</span><span class=\"p\">(</span><span class=\"s\">&quot;Greeting&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;alert(&#39;Hello world!&#39;)&quot;</span><span class=\"p\">)</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.javascript.button_to_function\">\n<!--[webhelpers.rails.javascript.button_to_function]--><tt class=\"descclassname\">webhelpers.rails.javascript.</tt><tt class=\"descname\">button_to_function</tt><big>(</big><em>name</em>, <em>function</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.javascript.button_to_function\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return a link that&#8217;ll trigger a JavaScript <tt class=\"docutils literal\"><span class=\"pre\">function</span></tt> using the \nonclick handler and return false after the fact.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"n\">button_to_function</span><span class=\"p\">(</span><span class=\"s\">&quot;Greeting&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;alert(&#39;Hello world!&#39;)&quot;</span><span class=\"p\">)</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.javascript.escape_javascript\">\n<!--[webhelpers.rails.javascript.escape_javascript]--><tt class=\"descclassname\">webhelpers.rails.javascript.</tt><tt class=\"descname\">escape_javascript</tt><big>(</big><em>javascript</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.javascript.escape_javascript\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Escape carriage returns and single and double quotes in <tt class=\"docutils literal\"><span class=\"pre\">javascript</span></tt>.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.javascript.javascript_tag\">\n<!--[webhelpers.rails.javascript.javascript_tag]--><tt class=\"descclassname\">webhelpers.rails.javascript.</tt><tt class=\"descname\">javascript_tag</tt><big>(</big><em>content</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.javascript.javascript_tag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return a JavaScript tag with the <tt class=\"docutils literal\"><span class=\"pre\">content</span></tt> inside.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">javascript_tag</span><span class=\"p\">(</span><span class=\"s\">&quot;alert(&#39;All is good&#39;)&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;script type=&quot;text/javascript&quot;&gt;\\n//&lt;![CDATA[\\nalert(\\&#39;All is good\\&#39;)\\n//]]&gt;\\n&lt;/script&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.javascript.javascript_cdata_section\">\n<!--[webhelpers.rails.javascript.javascript_cdata_section]--><tt class=\"descclassname\">webhelpers.rails.javascript.</tt><tt class=\"descname\">javascript_cdata_section</tt><big>(</big><em>content</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.javascript.javascript_cdata_section\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.javascript.options_for_javascript\">\n<!--[webhelpers.rails.javascript.options_for_javascript]--><tt class=\"descclassname\">webhelpers.rails.javascript.</tt><tt class=\"descname\">options_for_javascript</tt><big>(</big><em>options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.javascript.options_for_javascript\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.javascript.array_or_string_for_javascript\">\n<!--[webhelpers.rails.javascript.array_or_string_for_javascript]--><tt class=\"descclassname\">webhelpers.rails.javascript.</tt><tt class=\"descname\">array_or_string_for_javascript</tt><big>(</big><em>option</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.javascript.array_or_string_for_javascript\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"number\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">number</span></tt><a class=\"headerlink\" href=\"#number\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.number.number_to_phone\">\n<!--[webhelpers.rails.number.number_to_phone]--><tt class=\"descclassname\">webhelpers.rails.number.</tt><tt class=\"descname\">number_to_phone</tt><big>(</big><em>number</em>, <em>area_code=False</em>, <em>delimiter='-'</em>, <em>extension=''</em>, <em>country_code=''</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.number.number_to_phone\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format a <tt class=\"docutils literal\"><span class=\"pre\">number</span></tt> into a US phone number string.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">area_code</span></tt></dt>\n<dd>When enabled, adds parentheses around the area code. Defaults to \nFalse.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">delimiter</span></tt></dt>\n<dd>The delimiter to use, defaults to &#8220;-&#8220;.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">extension</span></tt></dt>\n<dd>Specifies an extension to add to the end of the generated number.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">country_code</span></tt></dt>\n<dd>Sets the country code for the phone number.</dd>\n</dl>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_phone</span><span class=\"p\">(</span><span class=\"mf\">1235551234</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;123-555-1234&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_phone</span><span class=\"p\">(</span><span class=\"mf\">1235551234</span><span class=\"p\">,</span> <span class=\"n\">area_code</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;(123) 555-1234&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_phone</span><span class=\"p\">(</span><span class=\"mf\">1235551234</span><span class=\"p\">,</span> <span class=\"n\">delimiter</span><span class=\"o\">=</span><span class=\"s\">&quot; &quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;123 555 1234&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_phone</span><span class=\"p\">(</span><span class=\"mf\">1235551234</span><span class=\"p\">,</span> <span class=\"n\">area_code</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">,</span> <span class=\"n\">extension</span><span class=\"o\">=</span><span class=\"mf\">555</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;(123) 555-1234 x 555&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_phone</span><span class=\"p\">(</span><span class=\"mf\">1235551234</span><span class=\"p\">,</span> <span class=\"n\">country_code</span><span class=\"o\">=</span><span class=\"mf\">1</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1-123-555-1234&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.number.number_to_currency\">\n<!--[webhelpers.rails.number.number_to_currency]--><tt class=\"descclassname\">webhelpers.rails.number.</tt><tt class=\"descname\">number_to_currency</tt><big>(</big><em>number</em>, <em>unit='$'</em>, <em>precision=2</em>, <em>separator='.'</em>, <em>delimiter='</em>, <em>'</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.number.number_to_currency\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format a <tt class=\"docutils literal\"><span class=\"pre\">number</span></tt> into a currency string.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">precision</span></tt></dt>\n<dd>Indicates the level of precision. Defaults to 2.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">unit</span></tt></dt>\n<dd>Sets the currency type. Defaults to &#8220;$&#8221;.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">separator</span></tt></dt>\n<dd>Used to set what the unit separation should be. Defaults to &#8220;.&#8221;.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">delimiter</span></tt></dt>\n<dd>The delimiter character to use. Defaults to &#8220;,&#8221;.</dd>\n</dl>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_currency</span><span class=\"p\">(</span><span class=\"mf\">1234567890.50</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;$1,234,567,890.50&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_currency</span><span class=\"p\">(</span><span class=\"mf\">1234567890.506</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;$1,234,567,890.51&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_currency</span><span class=\"p\">(</span><span class=\"mf\">1234567890.50</span><span class=\"p\">,</span> <span class=\"n\">unit</span><span class=\"o\">=</span><span class=\"s\">&quot;&amp;pound;&quot;</span><span class=\"p\">,</span> <span class=\"n\">separator</span><span class=\"o\">=</span><span class=\"s\">&quot;,&quot;</span><span class=\"p\">,</span> <span class=\"n\">delimiter</span><span class=\"o\">=</span><span class=\"s\">&quot;&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&amp;pound;1234567890,50&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.number.number_to_percentage\">\n<!--[webhelpers.rails.number.number_to_percentage]--><tt class=\"descclassname\">webhelpers.rails.number.</tt><tt class=\"descname\">number_to_percentage</tt><big>(</big><em>number</em>, <em>precision=3</em>, <em>separator='.'</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.number.number_to_percentage\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format a <tt class=\"docutils literal\"><span class=\"pre\">number</span></tt> as into a percentage string.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">precision</span></tt></dt>\n<dd>The level of precision, defaults to 3</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">separator</span></tt></dt>\n<dd>The unit separator to be used. Defaults to &#8220;.&#8221;</dd>\n</dl>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_percentage</span><span class=\"p\">(</span><span class=\"mf\">100</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;100.000%&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_percentage</span><span class=\"p\">(</span><span class=\"mf\">100</span><span class=\"p\">,</span> <span class=\"n\">precision</span><span class=\"o\">=</span><span class=\"mf\">0</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;100%&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_percentage</span><span class=\"p\">(</span><span class=\"mf\">302.0574</span><span class=\"p\">,</span> <span class=\"n\">precision</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;302.06%&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.number.number_to_human_size\">\n<!--[webhelpers.rails.number.number_to_human_size]--><tt class=\"descclassname\">webhelpers.rails.number.</tt><tt class=\"descname\">number_to_human_size</tt><big>(</big><em>size</em>, <em>precision=1</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.number.number_to_human_size\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return a formatted-for-humans file size.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">precision</span></tt></dt>\n<dd>The level of precision, defaults to 1</dd>\n</dl>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_human_size</span><span class=\"p\">(</span><span class=\"mf\">123</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;123 Bytes&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_human_size</span><span class=\"p\">(</span><span class=\"mf\">1234</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1.2 KB&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_human_size</span><span class=\"p\">(</span><span class=\"mf\">12345</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;12.1 KB&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_human_size</span><span class=\"p\">(</span><span class=\"mf\">1234567</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1.2 MB&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_human_size</span><span class=\"p\">(</span><span class=\"mf\">1234567890</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1.1 GB&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_human_size</span><span class=\"p\">(</span><span class=\"mf\">1234567890123</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1.1 TB&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_to_human_size</span><span class=\"p\">(</span><span class=\"mf\">1234567</span><span class=\"p\">,</span> <span class=\"mf\">2</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1.18 MB&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.number.human_size\">\n<!--[webhelpers.rails.number.human_size]--><tt class=\"descclassname\">webhelpers.rails.number.</tt><tt class=\"descname\">human_size</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.number.human_size\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Deprecated: Use number_to_human_size instead.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.number.number_with_delimiter\">\n<!--[webhelpers.rails.number.number_with_delimiter]--><tt class=\"descclassname\">webhelpers.rails.number.</tt><tt class=\"descname\">number_with_delimiter</tt><big>(</big><em>number</em>, <em>delimiter='</em>, <em>'</em>, <em>separator='.'</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.number.number_with_delimiter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format a <tt class=\"docutils literal\"><span class=\"pre\">number</span></tt> with grouped thousands using <tt class=\"docutils literal\"><span class=\"pre\">delimiter</span></tt>.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">delimiter</span></tt></dt>\n<dd>The delimiter character to use, defaults to &#8220;,&#8221;</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">separator</span></tt></dt>\n<dd>Used to set what the unit separation should be. Defaults to &#8220;.&#8221;</dd>\n</dl>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_with_delimiter</span><span class=\"p\">(</span><span class=\"mf\">12345678</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;12,345,678&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_with_delimiter</span><span class=\"p\">(</span><span class=\"mf\">12345678.05</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;12,345,678.05&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_with_delimiter</span><span class=\"p\">(</span><span class=\"mf\">12345678</span><span class=\"p\">,</span> <span class=\"n\">delimiter</span><span class=\"o\">=</span><span class=\"s\">&quot;.&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;12.345.678&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.number.number_with_precision\">\n<!--[webhelpers.rails.number.number_with_precision]--><tt class=\"descclassname\">webhelpers.rails.number.</tt><tt class=\"descname\">number_with_precision</tt><big>(</big><em>number</em>, <em>precision=3</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.number.number_with_precision\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format a <tt class=\"docutils literal\"><span class=\"pre\">number</span></tt> with a level of <tt class=\"docutils literal\"><span class=\"pre\">precision</span></tt>.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">precision</span></tt></dt>\n<dd>The level of precision, defaults to 3</dd>\n</dl>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_with_precision</span><span class=\"p\">(</span><span class=\"mf\">111.2346</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;111.235&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">number_with_precision</span><span class=\"p\">(</span><span class=\"mf\">111.2346</span><span class=\"p\">,</span> <span class=\"mf\">2</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;111.23&#39;</span>\n</pre></div>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"prototype\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">prototype</span></tt><a class=\"headerlink\" href=\"#prototype\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Deprecated, will be removed. No replacement is planned.</p>\n</div>\n</div>\n<div class=\"section\" id=\"scriptaculous\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">scriptaculous</span></tt><a class=\"headerlink\" href=\"#scriptaculous\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Deprecated, will be removed. No replacement is planned.</p>\n</div>\n</div>\n<div class=\"section\" id=\"secure-form-tag\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">secure_form_tag</span></tt><a class=\"headerlink\" href=\"#secure-form-tag\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.secure_form_tag.get_session\">\n<!--[webhelpers.rails.secure_form_tag.get_session]--><tt class=\"descclassname\">webhelpers.rails.secure_form_tag.</tt><tt class=\"descname\">get_session</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.secure_form_tag.get_session\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return the current session from the environ provided by routes.</p>\n<p>A Pylons-supported session is assumed. A KeyError is raised if one \ndoesn&#8217;t exist.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.secure_form_tag.authentication_token\">\n<!--[webhelpers.rails.secure_form_tag.authentication_token]--><tt class=\"descclassname\">webhelpers.rails.secure_form_tag.</tt><tt class=\"descname\">authentication_token</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.secure_form_tag.authentication_token\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return the current (or a newly created) authentication token.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.secure_form_tag.secure_form\">\n<!--[webhelpers.rails.secure_form_tag.secure_form]--><tt class=\"descclassname\">webhelpers.rails.secure_form_tag.</tt><tt class=\"descname\">secure_form</tt><big>(</big><em>url</em>, <em>**args</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.secure_form_tag.secure_form\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a form tag including a hidden authentication token field.</p>\n<p>Like webhelpers.rails.form_tag.form.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.secure_form_tag.secure_form_remote_tag\">\n<!--[webhelpers.rails.secure_form_tag.secure_form_remote_tag]--><tt class=\"descclassname\">webhelpers.rails.secure_form_tag.</tt><tt class=\"descname\">secure_form_remote_tag</tt><big>(</big><em>**args</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.secure_form_tag.secure_form_remote_tag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a form tag including a hidden authentication token field.</p>\n<p>Like webhelpers.rails.prototype.form_remote_tag.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.secure_form_tag.secure_button_to\">\n<!--[webhelpers.rails.secure_form_tag.secure_button_to]--><tt class=\"descclassname\">webhelpers.rails.secure_form_tag.</tt><tt class=\"descname\">secure_button_to</tt><big>(</big><em>name</em>, <em>url=''</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.secure_form_tag.secure_button_to\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Create a button (like webhelpers.rails.urls.button_to) including a\nhidden authentication token field.</dd></dl>\n\n</div>\n<div class=\"section\" id=\"tags\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">tags</span></tt><a class=\"headerlink\" href=\"#tags\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.camelize\">\n<!--[webhelpers.rails.tags.camelize]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">camelize</tt><big>(</big><em>name</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.camelize\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Camelize a <tt class=\"docutils literal\"><span class=\"pre\">name</span></tt>.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.strip_unders\">\n<!--[webhelpers.rails.tags.strip_unders]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">strip_unders</tt><big>(</big><em>options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.strip_unders\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.tag\">\n<!--[webhelpers.rails.tags.tag]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">tag</tt><big>(</big><em>tag_name</em>, <em>open=False</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.tag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return an XHTML-compliant tag of type <tt class=\"docutils literal\"><span class=\"pre\">name</span></tt>.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">open</span></tt></dt>\n<dd>Set to True if the tag should remain open</dd>\n</dl>\n<p>All additional keyword args become attribute/value&#8217;s for the tag. \nTo pass in Python reserved words, append _ to the name of the key. \nFor attributes with no value (such as disabled and readonly), a \nvalue of True is permitted.</p>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">tag</span><span class=\"p\">(</span><span class=\"s\">&quot;br&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;br /&gt;&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">tag</span><span class=\"p\">(</span><span class=\"s\">&quot;br&quot;</span><span class=\"p\">,</span> <span class=\"bp\">True</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;br&gt;&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">tag</span><span class=\"p\">(</span><span class=\"s\">&quot;input&quot;</span><span class=\"p\">,</span> <span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;text&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;input type=&quot;text&quot; /&gt;&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">tag</span><span class=\"p\">(</span><span class=\"s\">&quot;input&quot;</span><span class=\"p\">,</span> <span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;text&#39;</span><span class=\"p\">,</span> <span class=\"n\">disabled</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;input disabled=&quot;disabled&quot; type=&quot;text&quot; /&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.content_tag\">\n<!--[webhelpers.rails.tags.content_tag]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">content_tag</tt><big>(</big><em>name</em>, <em>content</em>, <em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.content_tag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a tag with content.</p>\n<p>Takes the same keyword args as <tt class=\"docutils literal\"><span class=\"pre\">tag</span></tt>.</p>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">content_tag</span><span class=\"p\">(</span><span class=\"s\">&quot;p&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;Hello world!&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;p&gt;Hello world!&lt;/p&gt;&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">content_tag</span><span class=\"p\">(</span><span class=\"s\">&quot;div&quot;</span><span class=\"p\">,</span> <span class=\"n\">content_tag</span><span class=\"p\">(</span><span class=\"s\">&quot;p&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;Hello world!&quot;</span><span class=\"p\">),</span> <span class=\"n\">class_</span><span class=\"o\">=</span><span class=\"s\">&quot;strong&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;div class=&quot;strong&quot;&gt;&lt;p&gt;Hello world!&lt;/p&gt;&lt;/div&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.cdata_section\">\n<!--[webhelpers.rails.tags.cdata_section]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">cdata_section</tt><big>(</big><em>content</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.cdata_section\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return a CDATA section with the given <tt class=\"docutils literal\"><span class=\"pre\">content</span></tt>.</p>\n<p>CDATA sections are used to escape blocks of text containing \ncharacters which would otherwise be recognized as markup. CDATA \nsections begin with the string <tt class=\"docutils literal\"><span class=\"pre\">&lt;![CDATA[</span></tt> and end with (and may \nnot contain) the string <tt class=\"docutils literal\"><span class=\"pre\">]]&gt;</span></tt>.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.escape_once\">\n<!--[webhelpers.rails.tags.escape_once]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">escape_once</tt><big>(</big><em>html</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.escape_once\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Escape a given string without affecting existing escaped entities.</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">escape_once</span><span class=\"p\">(</span><span class=\"s\">&quot;1 &lt; 2 &amp;amp; 3&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1 &amp;lt; 2 &amp;amp; 3&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.fix_double_escape\">\n<!--[webhelpers.rails.tags.fix_double_escape]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">fix_double_escape</tt><big>(</big><em>escaped</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.fix_double_escape\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Fix double-escaped entities, such as &amp;amp;amp;, &amp;amp;#123;, etc.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.tag_options\">\n<!--[webhelpers.rails.tags.tag_options]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">tag_options</tt><big>(</big><em>**options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.tag_options\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.convert_booleans\">\n<!--[webhelpers.rails.tags.convert_booleans]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">convert_booleans</tt><big>(</big><em>options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.convert_booleans\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.tags.boolean_attribute\">\n<!--[webhelpers.rails.tags.boolean_attribute]--><tt class=\"descclassname\">webhelpers.rails.tags.</tt><tt class=\"descname\">boolean_attribute</tt><big>(</big><em>options</em>, <em>attribute</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.tags.boolean_attribute\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"text\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">text</span></tt><a class=\"headerlink\" href=\"#text\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.cycle\">\n<!--[webhelpers.rails.text.cycle]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">cycle</tt><big>(</big><em>*args</em>, <em>**kargs</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.cycle\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return the next cycle of the given list.</p>\n<p>Everytime <tt class=\"docutils literal\"><span class=\"pre\">cycle</span></tt> is called, the value returned will be the next \nitem in the list passed to it. This list is reset on every request, \nbut can also be reset by calling <tt class=\"docutils literal\"><span class=\"pre\">reset_cycle()</span></tt>.</p>\n<p>You may specify the list as either arguments, or as a single list \nargument.</p>\n<p>This can be used to alternate classes for table rows:</p>\n<pre># In Myghty...\n% for item in items:\n&lt;tr class=\"&lt;% cycle(\"even\", \"odd\") %&gt;\"&gt;\n    ... use item ...\n&lt;/tr&gt;\n% #endfor</pre>\n<p>You can use named cycles to prevent clashes in nested loops. You&#8217;ll\nhave to reset the inner cycle, manually:</p>\n<pre>% for item in items:\n&lt;tr class=\"&lt;% cycle(\"even\", \"odd\", name=\"row_class\") %&gt;\n    &lt;td&gt;\n%     for value in item.values:\n        &lt;span style=\"color:'&lt;% cycle(\"red\", \"green\", \"blue\",\n                                     name=\"colors\") %&gt;'\"&gt;\n                    item\n        &lt;/span&gt;\n%     #endfor\n    &lt;% reset_cycle(\"colors\") %&gt;\n    &lt;/td&gt;\n&lt;/tr&gt;\n% #endfor</pre>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.reset_cycle\">\n<!--[webhelpers.rails.text.reset_cycle]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">reset_cycle</tt><big>(</big><em>name='default'</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.reset_cycle\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Reset a cycle.</p>\n<p>Resets the cycle so that it starts from the first element in the \narray the next time it is used.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.counter\">\n<!--[webhelpers.rails.text.counter]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">counter</tt><big>(</big><em>name='default'</em>, <em>start=1</em>, <em>step=1</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.counter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return the next cardinal in a sequence.</p>\n<p>Every time <tt class=\"docutils literal\"><span class=\"pre\">counter</span></tt> is called, the value returned will be the next\ncounting number in that sequence.  This is reset to <tt class=\"docutils literal\"><span class=\"pre\">start</span></tt> on every\nrequest, but can also be reset by calling <tt class=\"docutils literal\"><span class=\"pre\">reset_counter()</span></tt>.</p>\n<p>You can optionally specify the number you want to start at by passing\nin the <tt class=\"docutils literal\"><span class=\"pre\">start</span></tt> argument (defaults to 1).</p>\n<p>You can also optionally specify the step size you want by passing in\nthe <tt class=\"docutils literal\"><span class=\"pre\">step</span></tt> argument (defaults to 1).</p>\n<p>Sequences will increase monotonically by <tt class=\"docutils literal\"><span class=\"pre\">step</span></tt> each time it is\ncalled, until the heat death of the universe or python explodes.</p>\n<p>This can be used to count rows in a table:</p>\n<pre># In Myghty\n% for item in items:\n&lt;tr&gt;\n    &lt;td&gt;&lt;% h.counter() %&gt;&lt;/td&gt;\n&lt;/tr&gt;\n% #endfor</pre>\n<p>You can use named counters to prevent clashes in nested loops.\nYou&#8217;ll have to reset the inner cycle manually though.  See the\ndocumentation for <tt class=\"docutils literal\"><span class=\"pre\">webhelpers.text.cycle()</span></tt> for a similar\nexample.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.reset_counter\">\n<!--[webhelpers.rails.text.reset_counter]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">reset_counter</tt><big>(</big><em>name='default'</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.reset_counter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Reset a counter.</p>\n<p>Resets the counter so that it starts from the <tt class=\"docutils literal\"><span class=\"pre\">start</span></tt> cardinal in\nthe sequence next time it is used.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.truncate\">\n<!--[webhelpers.rails.text.truncate]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">truncate</tt><big>(</big><em>text</em>, <em>length=30</em>, <em>truncate_string='...'</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.truncate\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Truncate <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt> with replacement characters.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">length</span></tt></dt>\n<dd>The maximum length of <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt> before replacement</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">truncate_string</span></tt></dt>\n<dd>If <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt> exceeds the <tt class=\"docutils literal\"><span class=\"pre\">length</span></tt>, this string will replace\nthe end of the string</dd>\n</dl>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">truncate</span><span class=\"p\">(</span><span class=\"s\">&#39;Once upon a time in a world far far away&#39;</span><span class=\"p\">,</span> <span class=\"mf\">14</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;Once upon a...&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.highlight\">\n<!--[webhelpers.rails.text.highlight]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">highlight</tt><big>(</big><em>text</em>, <em>phrase</em>, <em>highlighter='&lt;strong class=&quot;highlight&quot;&gt;1&lt;/strong&gt;'</em>, <em>hilighter=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.highlight\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Highlight the <tt class=\"docutils literal\"><span class=\"pre\">phrase</span></tt> where it is found in the <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt>.</p>\n<p>The highlighted phrase will be surrounded by the highlighter, \nby default:</p>\n<pre>&lt;strong class=\"highlight\"&gt;I'm a highlight phrase&lt;/strong&gt;</pre>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">highlighter</span></tt></dt>\n<dd>Defines the highlighting phrase. This argument should be a \nsingle-quoted string with <tt class=\"docutils literal\"><span class=\"pre\">\\1</span></tt> where the phrase is supposed \nto be inserted.</dd>\n</dl>\n<p>Note: The <tt class=\"docutils literal\"><span class=\"pre\">phrase</span></tt> is sanitized to include only letters, digits, \nand spaces before use.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">highlight</span><span class=\"p\">(</span><span class=\"s\">&#39;You searched for: Pylons&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;Pylons&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;You searched for: &lt;strong class=&quot;highlight&quot;&gt;Pylons&lt;/strong&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.excerpt\">\n<!--[webhelpers.rails.text.excerpt]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">excerpt</tt><big>(</big><em>text</em>, <em>phrase</em>, <em>radius=100</em>, <em>excerpt_string='...'</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.excerpt\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Extract an excerpt from the <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt>, or &#8216;&#8217; if the phrase isn&#8217;t found.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">phrase</span></tt></dt>\n<dd>Phrase to excerpt from <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt></dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">radius</span></tt></dt>\n<dd>How many surrounding characters to include</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">excerpt_string</span></tt></dt>\n<dd>Characters surrounding entire excerpt</dd>\n</dl>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">excerpt</span><span class=\"p\">(</span><span class=\"s\">&quot;hello my world&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;my&quot;</span><span class=\"p\">,</span> <span class=\"mf\">3</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;...lo my wo...&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.word_wrap\">\n<!--[webhelpers.rails.text.word_wrap]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">word_wrap</tt><big>(</big><em>text</em>, <em>line_width=80</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.word_wrap\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Wrap <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt> into lines of at most <tt class=\"docutils literal\"><span class=\"pre\">line_width</span></tt> width.  Deprecated.</p>\n<p>This is deprecated: Use python&#8217;s builtin textwrap.fill instead.</p>\n<p>This function breaks on the first whitespace character that does not \nexceed <tt class=\"docutils literal\"><span class=\"pre\">line_width</span></tt>.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.simple_format\">\n<!--[webhelpers.rails.text.simple_format]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">simple_format</tt><big>(</big><em>text</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.simple_format\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt> transformed into HTML using simple formatting rules.</p>\n<p>Two or more consecutive newlines(<tt class=\"docutils literal\"><span class=\"pre\">\\n\\n</span></tt>) are considered as a \nparagraph and wrapped in <tt class=\"docutils literal\"><span class=\"pre\">&lt;p&gt;</span></tt> tags. One newline (<tt class=\"docutils literal\"><span class=\"pre\">\\n</span></tt>) is \nconsidered a linebreak and a <tt class=\"docutils literal\"><span class=\"pre\">&lt;br</span> <span class=\"pre\">/&gt;</span></tt> tag is appended. This method \ndoes not remove the newlines from the text.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.auto_link\">\n<!--[webhelpers.rails.text.auto_link]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">auto_link</tt><big>(</big><em>text</em>, <em>link='all'</em>, <em>**href_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.auto_link\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Turn all urls and email addresses into clickable links.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">link</span></tt></dt>\n<dd>Used to determine what to link. Options are &#8220;all&#8221;, \n&#8220;email_addresses&#8221;, or &#8220;urls&#8221;</dd>\n</dl>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">auto_link</span><span class=\"p\">(</span><span class=\"s\">&quot;Go to http://www.planetpython.com and say hello to guido@python.org&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;Go to &lt;a href=&quot;http://www.planetpython.com&quot;&gt;http://www.planetpython.com&lt;/a&gt; and say hello to &lt;a href=&quot;mailto:guido@python.org&quot;&gt;guido@python.org&lt;/a&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.auto_link_urls\">\n<!--[webhelpers.rails.text.auto_link_urls]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">auto_link_urls</tt><big>(</big><em>text</em>, <em>**href_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.auto_link_urls\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.auto_link_email_addresses\">\n<!--[webhelpers.rails.text.auto_link_email_addresses]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">auto_link_email_addresses</tt><big>(</big><em>text</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.auto_link_email_addresses\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.strip_links\">\n<!--[webhelpers.rails.text.strip_links]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">strip_links</tt><big>(</big><em>text</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.strip_links\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Strip link tags from <tt class=\"docutils literal\"><span class=\"pre\">text</span></tt> leaving just the link label.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">strip_links</span><span class=\"p\">(</span><span class=\"s\">&#39;&lt;a href=&quot;something&quot;&gt;else&lt;/a&gt;&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;else&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.textilize\">\n<!--[webhelpers.rails.text.textilize]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">textilize</tt><big>(</big><em>text</em>, <em>sanitize=False</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.textilize\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format the text with Textile formatting.</p>\n<p>This function uses the <a class=\"reference external\" href=\"http://dealmeida.net/\">PyTextile library</a> \nwhich is included with WebHelpers.</p>\n<p>Additionally, the output can be sanitized which will fix tags like \n&lt;img /&gt;,  &lt;br /&gt; and &lt;hr /&gt; for proper XHTML output.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.text.markdown\">\n<!--[webhelpers.rails.text.markdown]--><tt class=\"descclassname\">webhelpers.rails.text.</tt><tt class=\"descname\">markdown</tt><big>(</big><em>text</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.text.markdown\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format the text with MarkDown formatting.</p>\n<p>This function uses the <a class=\"reference external\" href=\"http://www.freewisdom.org/projects/python-markdown/\">Python MarkDown library</a>\nwhich is included with WebHelpers.</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"urls\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">urls</span></tt><a class=\"headerlink\" href=\"#urls\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.get_url\">\n<!--[webhelpers.rails.urls.get_url]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">get_url</tt><big>(</big><em>url</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.get_url\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.url\">\n<!--[webhelpers.rails.urls.url]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">url</tt><big>(</big><em>*args</em>, <em>**kargs</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.url\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Lazily evaluates url_for() arguments.</p>\n<p>Used instead of url_for() for functions so that the function will be \nevaluated in a lazy manner rather than at initial function call.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.link_to\">\n<!--[webhelpers.rails.urls.link_to]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">link_to</tt><big>(</big><em>name</em>, <em>url=''</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.link_to\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create link tag with text <tt class=\"docutils literal\"><span class=\"pre\">name</span></tt> and a URL created by the set of <tt class=\"docutils literal\"><span class=\"pre\">options</span></tt>.</p>\n<p>See the valid options in the documentation for Routes url_for.</p>\n<p>The html_options has three special features. One for creating \njavascript confirm alerts where if you pass <tt class=\"docutils literal\"><span class=\"pre\">confirm='Are</span> <span class=\"pre\">you</span> <span class=\"pre\">sure?'</span></tt>, \nthe link will be guarded with a JS popup asking that question. If \nthe user accepts, the link is processed, otherwise not.</p>\n<p>Another for creating a popup window, which is done by either passing \n<tt class=\"docutils literal\"><span class=\"pre\">popup</span></tt> with True or the options of the window in Javascript form.</p>\n<p>And a third for making the link do a POST request (instead of the \nregular GET) through a dynamically added form element that is \ninstantly submitted. Note that if the user has turned off Javascript, \nthe request will fall back on the GET. So its your responsibility to \ndetermine what the action should be once it arrives at the controller. \nThe POST form is turned on by passing <tt class=\"docutils literal\"><span class=\"pre\">post</span></tt> as True. Note, it&#8217;s \nnot possible to use POST requests and popup targets at the same time \n(an exception will be thrown).</p>\n<p>Examples:</p>\n<pre>&gt;&gt; link_to(\"Delete this page\", url(action=\"destroy\", id=4), confirm=\"Are you sure?\")\n&gt;&gt; link_to(\"Help\", url(action=\"help\"), popup=True)\n&gt;&gt; link_to(\"Busy loop\", url(action=\"busy\"), popup=['new_window', 'height=300,width=600'])\n&gt;&gt; link_to(\"Destroy account\", url(action=\"destroy\"), confirm=\"Are you sure?\", method='delete')</pre>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.button_to\">\n<!--[webhelpers.rails.urls.button_to]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">button_to</tt><big>(</big><em>name</em>, <em>url=''</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.button_to\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Generate a form containing a sole button that submits to <tt class=\"docutils literal\"><span class=\"pre\">url</span></tt>.</p>\n<p>Use this method instead of <tt class=\"docutils literal\"><span class=\"pre\">link_to</span></tt> for actions that do not have \nthe safe HTTP GET semantics implied by using a hypertext link.</p>\n<p>The parameters are the same as for <tt class=\"docutils literal\"><span class=\"pre\">link_to</span></tt>.  Any <tt class=\"docutils literal\"><span class=\"pre\">html_options</span></tt> \nthat you pass will be applied to the inner <tt class=\"docutils literal\"><span class=\"pre\">input</span></tt> element. In \nparticular, pass</p>\n<blockquote>\ndisabled = True/False</blockquote>\n<p>as part of <tt class=\"docutils literal\"><span class=\"pre\">html_options</span></tt> to control whether the button is\ndisabled.  The generated form element is given the class\n&#8216;button-to&#8217;, to which you can attach CSS styles for display\npurposes.</p>\n<p>The submit button itself will be displayed as an image if you \nprovide both <tt class=\"docutils literal\"><span class=\"pre\">type</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">src</span></tt> as followed:</p>\n<blockquote>\ntype=&#8217;image&#8217;, src=&#8217;icon_delete.gif&#8217;</blockquote>\n<p>The <tt class=\"docutils literal\"><span class=\"pre\">src</span></tt> path will be computed as the image_tag() computes its \n<tt class=\"docutils literal\"><span class=\"pre\">source</span></tt> argument.</p>\n<p>Example 1:</p>\n<pre># inside of controller for \"feeds\"\n&gt;&gt; button_to(\"Edit\", url(action='edit', id=3))\n&lt;form method=\"POST\" action=\"/feeds/edit/3\" class=\"button-to\"&gt;\n&lt;div&gt;&lt;input value=\"Edit\" type=\"submit\" /&gt;&lt;/div&gt;\n&lt;/form&gt;</pre>\n<p>Example 2:</p>\n<pre>&gt;&gt; button_to(\"Destroy\", url(action='destroy', id=3), confirm=\"Are you sure?\", method='DELETE')\n&lt;form method=\"POST\" action=\"/feeds/destroy/3\" class=\"button-to\"&gt;\n&lt;div&gt;\n    &lt;input type=\"hidden\" name=\"_method\" value=\"DELETE\" /&gt;\n    &lt;input onclick=\"return confirm('Are you sure?');\" value=\"Destroy\" type=\"submit\" /&gt;\n&lt;/div&gt;\n&lt;/form&gt;</pre>\n<p>Example 3:</p>\n<pre># Button as an image.\n&gt;&gt; button_to(\"Edit\", url(action='edit', id=3), type='image', src='icon_delete.gif')\n&lt;form method=\"POST\" action=\"/feeds/edit/3\" class=\"button-to\"&gt;\n&lt;div&gt;&lt;input alt=\"Edit\" src=\"/images/icon_delete.gif\" type=\"image\" value=\"Edit\" /&gt;&lt;/div&gt;\n&lt;/form&gt;</pre>\n<p><em>NOTE</em>: This method generates HTML code that represents a form.\nForms are &#8220;block&#8221; content, which means that you should not try to\ninsert them into your HTML where only inline content is expected.\nFor example, you can legally insert a form inside of a <tt class=\"docutils literal\"><span class=\"pre\">div</span></tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">td</span></tt> element or in between <tt class=\"docutils literal\"><span class=\"pre\">p</span></tt> elements, but not in the middle \nof a run of text, nor can you place a form within another form.\n(Bottom line: Always validate your HTML before going public.)</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.link_to_unless_current\">\n<!--[webhelpers.rails.urls.link_to_unless_current]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">link_to_unless_current</tt><big>(</big><em>name</em>, <em>url</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.link_to_unless_current\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Conditionally create a link tag of the given <tt class=\"docutils literal\"><span class=\"pre\">name</span></tt> using the <tt class=\"docutils literal\"><span class=\"pre\">url</span></tt>.</p>\n<p>If the current request uri is the same as the link&#8217;s only the name is \nreturned. This is useful for creating link bars where you don&#8217;t want \nto link to the page currently being viewed.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.link_to_unless\">\n<!--[webhelpers.rails.urls.link_to_unless]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">link_to_unless</tt><big>(</big><em>condition</em>, <em>name</em>, <em>url</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.link_to_unless\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Conditionally create a link tag of the given <tt class=\"docutils literal\"><span class=\"pre\">name</span></tt> using the <tt class=\"docutils literal\"><span class=\"pre\">url</span></tt>.</p>\n<p>If <tt class=\"docutils literal\"><span class=\"pre\">condition</span></tt> is True only the name is returned.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.link_to_if\">\n<!--[webhelpers.rails.urls.link_to_if]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">link_to_if</tt><big>(</big><em>condition</em>, <em>name</em>, <em>url</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.link_to_if\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Conditionally create a link tag of the given <tt class=\"docutils literal\"><span class=\"pre\">name</span></tt> using the <tt class=\"docutils literal\"><span class=\"pre\">url</span></tt>.</p>\n<p>If <tt class=\"docutils literal\"><span class=\"pre\">condition</span></tt> is True only the name is returned.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.current_page\">\n<!--[webhelpers.rails.urls.current_page]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">current_page</tt><big>(</big><em>url</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.current_page\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return true if the current page uri is equivalent to <tt class=\"docutils literal\"><span class=\"pre\">url</span></tt>.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.current_url\">\n<!--[webhelpers.rails.urls.current_url]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">current_url</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.current_url\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return the current page&#8217;s url.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.convert_options_to_javascript\">\n<!--[webhelpers.rails.urls.convert_options_to_javascript]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">convert_options_to_javascript</tt><big>(</big><em>confirm=None</em>, <em>popup=None</em>, <em>post=None</em>, <em>method=None</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.convert_options_to_javascript\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.convert_boolean_attributes\">\n<!--[webhelpers.rails.urls.convert_boolean_attributes]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">convert_boolean_attributes</tt><big>(</big><em>html_options</em>, <em>bool_attrs</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.convert_boolean_attributes\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.confirm_javascript_function\">\n<!--[webhelpers.rails.urls.confirm_javascript_function]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">confirm_javascript_function</tt><big>(</big><em>confirm</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.confirm_javascript_function\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.popup_javascript_function\">\n<!--[webhelpers.rails.urls.popup_javascript_function]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">popup_javascript_function</tt><big>(</big><em>popup</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.popup_javascript_function\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.method_javascript_function\">\n<!--[webhelpers.rails.urls.method_javascript_function]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">method_javascript_function</tt><big>(</big><em>method</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.method_javascript_function\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.mail_to\">\n<!--[webhelpers.rails.urls.mail_to]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">mail_to</tt><big>(</big><em>email_address</em>, <em>name=None</em>, <em>cc=None</em>, <em>bcc=None</em>, <em>subject=None</em>, <em>body=None</em>, <em>replace_at=None</em>, <em>replace_dot=None</em>, <em>encode=None</em>, <em>**html_options</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.mail_to\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a link tag for starting an email to the specified <tt class=\"docutils literal\"><span class=\"pre\">email_address</span></tt>.</p>\n<p>This <tt class=\"docutils literal\"><span class=\"pre\">email_address</span></tt> is also used as the name of the link unless\n<tt class=\"docutils literal\"><span class=\"pre\">name</span></tt> is specified. Additional HTML options, such as class or id, \ncan be passed in the <tt class=\"docutils literal\"><span class=\"pre\">html_options</span></tt> hash.</p>\n<p>You can also make it difficult for spiders to harvest email address \nby obfuscating them.</p>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">mail_to</span><span class=\"p\">(</span><span class=\"s\">&quot;me@domain.com&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;My email&quot;</span><span class=\"p\">,</span> <span class=\"n\">encode</span> <span class=\"o\">=</span> <span class=\"s\">&quot;javascript&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;script type=&quot;text/javascript&quot;&gt;\\n//&lt;![CDATA[\\neval(unescape(\\&#39;%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b\\&#39;))\\n//]]&gt;\\n&lt;/script&gt;&#39;</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">mail_to</span><span class=\"p\">(</span><span class=\"s\">&quot;me@domain.com&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;My email&quot;</span><span class=\"p\">,</span> <span class=\"n\">encode</span> <span class=\"o\">=</span> <span class=\"s\">&quot;hex&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;a href=&quot;&amp;#109;&amp;#97;&amp;#105;&amp;#108;&amp;#116;&amp;#111;&amp;#58;%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d&quot;&gt;My email&lt;/a&gt;&#39;</span>\n</pre></div>\n<p>You can also specify the cc address, bcc address, subject, and body \nparts of the message header to create a complex e-mail using the \ncorresponding <tt class=\"docutils literal\"><span class=\"pre\">cc</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">bcc</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">subject</span></tt>, and <tt class=\"docutils literal\"><span class=\"pre\">body</span></tt> keyword \narguments. Each of these options are URI escaped and then appended \nto the <tt class=\"docutils literal\"><span class=\"pre\">email_address</span></tt> before being output. <strong>Be aware that \njavascript keywords will not be escaped and may break this feature \nwhen encoding with javascript.</strong></p>\n<p>Examples:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">mail_to</span><span class=\"p\">(</span><span class=\"s\">&quot;me@domain.com&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;My email&quot;</span><span class=\"p\">,</span> <span class=\"n\">cc</span><span class=\"o\">=</span><span class=\"s\">&quot;ccaddress@domain.com&quot;</span><span class=\"p\">,</span> <span class=\"n\">bcc</span><span class=\"o\">=</span><span class=\"s\">&quot;bccaddress@domain.com&quot;</span><span class=\"p\">,</span> <span class=\"n\">subject</span><span class=\"o\">=</span><span class=\"s\">&quot;This is an example email&quot;</span><span class=\"p\">,</span> <span class=\"n\">body</span><span class=\"o\">=</span> <span class=\"s\">&quot;This is the body of the message.&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;a href=&quot;mailto:me@domain.com?cc=ccaddress%40domain.com&amp;amp;bcc=bccaddress%40domain.com&amp;amp;subject=This%20is%20an%20example%20email&amp;amp;body=This%20is%20the%20body%20of%20the%20message.&quot;&gt;My email&lt;/a&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.urls.js_obfuscate\">\n<!--[webhelpers.rails.urls.js_obfuscate]--><tt class=\"descclassname\">webhelpers.rails.urls.</tt><tt class=\"descname\">js_obfuscate</tt><big>(</big><em>data</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.urls.js_obfuscate\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Obfuscate data in a Javascript tag.</p>\n<p>Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">js_obfuscate</span><span class=\"p\">(</span><span class=\"s\">&quot;&lt;input type=&#39;hidden&#39; name=&#39;check&#39; value=&#39;valid&#39; /&gt;&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;script type=&quot;text/javascript&quot;&gt;\\n//&lt;![CDATA[\\neval(unescape(\\&#39;%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%69%6e%70%75%74%20%74%79%70%65%3d%27%68%69%64%64%65%6e%27%20%6e%61%6d%65%3d%27%63%68%65%63%6b%27%20%76%61%6c%75%65%3d%27%76%61%6c%69%64%27%20%2f%3e%27%29%3b\\&#39;))\\n//]]&gt;\\n&lt;/script&gt;&#39;</span>\n</pre></div>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"wrapped\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">wrapped</span></tt><a class=\"headerlink\" href=\"#wrapped\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.rails.wrapped.wrap_helpers\">\n<!--[webhelpers.rails.wrapped.wrap_helpers]--><tt class=\"descclassname\">webhelpers.rails.wrapped.</tt><tt class=\"descname\">wrap_helpers</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.rails.wrapped.wrap_helpers\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"javascripts\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">javascripts</span></tt><a class=\"headerlink\" href=\"#javascripts\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Deprecated, will be removed. No replacement is planned.</p>\n</div>\n</div>\n</div>\n", 
   "current_page_name": "thirdparty/webhelpers/rails/rails", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 1bc35b0c8f8ff5b8b010364bf3963bd6
-ETag: 1963059442
+ETag: 299211740
 
 {
   "_id": "1bc35b0c8f8ff5b8b010364bf3963bd6", 
-  "_rev": "1963059442", 
+  "_rev": "299211740", 
   "body": "<div class=\"section\" id=\"wsgi-cli-scripts\">\n<span id=\"paster\"></span><h1>WSGI, CLI scripts<a class=\"headerlink\" href=\"#wsgi-cli-scripts\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"working-with-wsgiwrappers-wsgirequest\">\n<h2>Working with <tt class=\"xref docutils literal\"><span class=\"pre\">wsgiwrappers.WSGIRequest</span></tt><a class=\"headerlink\" href=\"#working-with-wsgiwrappers-wsgirequest\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Pylons uses a specialised <em>WSGIRequest</em> class that is accessible via the\n<tt class=\"docutils literal\"><span class=\"pre\">paste.wsgiwrappers</span></tt> module.</p>\n<p>The <tt class=\"docutils literal\"><span class=\"pre\">wsgiwrappers.WSGIRequest</span></tt> object represents a WSGI request that has\na more programmer-friendly interface. This interface does not expose every\ndetail of the WSGI environment <em>(why?)</em> and does not attempt to express\nanything beyond what is available in the environment dictionary.</p>\n<p>The only state maintained in this object is the desired <tt class=\"docutils literal\"><span class=\"pre\">charset</span></tt>, an\nassociated errors handler and a <tt class=\"docutils literal\"><span class=\"pre\">decode_param_names</span></tt> option.</p>\n<blockquote id=\"note\">\n<p><em>Unicode notes</em></p>\n<p>When <tt class=\"docutils literal\"><span class=\"pre\">charset</span></tt> is set, the incoming parameter values will be\nautomatically coerced to unicode objects of the charset encoding.</p>\n<p>When unicode is expected, <tt class=\"docutils literal\"><span class=\"pre\">charset</span></tt> will be overridden by the the value\nof the charset parameter set in the Content-Type header, if one was\nspecified by the client.</p>\n<p>The incoming parameter names are not decoded to unicode unless the\ndecode_param_names option is enabled.</p>\n</blockquote>\n<p>The class variable <tt class=\"docutils literal\"><span class=\"pre\">defaults</span></tt> specifies default values for charset, errors,\nand language. These default values can be overridden for the current request\nvia the registry <em>(what&#8217;s a registry?)</em>.</p>\n<p>The language default value is considered the fallback during i18n\ntranslations to ensure in odd cases that mixed languages don&#8217;t occur should\nthe language file contain the string but not another language in the accepted\nlanguages list. The language value only applies when getting a list of\naccepted languages from the HTTP Accept header.</p>\n<p>This behavior is duplicated from Aquarium, and may seem strange but is very\nuseful. Normally, everything in the code is in &#8220;en-us&#8221;. However, the &#8220;en-us&#8221;\ntranslation catalog is usually empty. If the user requests [&#8220;en-us&#8221;, &#8220;zh-cn&#8221;]\nand a translation isn&#8217;t found for a string in &#8220;en-us&#8221;, you don&#8217;t want gettext\nto fallback to &#8220;zh-cn&#8221;. You want it to just use the string itself. Hence, if\na string isn&#8217;t found in the language catalog, the string in the source code\nwill be used.</p>\n<p>All other state is kept in the environment dictionary; this is essential for\ninteroperability.</p>\n<p>You are free to subclass this object.</p>\n</div>\n<div class=\"section\" id=\"attributes\">\n<h2>Attributes<a class=\"headerlink\" href=\"#attributes\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"section\" id=\"get\">\n<h3>GET<a class=\"headerlink\" href=\"#get\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>A dictionary-like object representing the QUERY_STRING parameters. Always present, possibly empty.</p>\n<p>If the same key is present in the query string multiple times, a list of its\nvalues can be retrieved from the <tt class=\"xref docutils literal\"><span class=\"pre\">MultiDict</span></tt> via the :meth:<tt class=\"docutils literal\"><span class=\"pre\">getall</span></tt>\nmethod.</p>\n<p>Returns a <tt class=\"xref docutils literal\"><span class=\"pre\">MultiDict</span></tt> container or, when charset is set, a <tt class=\"xref docutils literal\"><span class=\"pre\">UnicodeMultiDict</span></tt>.</p>\n</div>\n<div class=\"section\" id=\"post\">\n<h3>POST<a class=\"headerlink\" href=\"#post\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>A dictionary-like object representing the <tt class=\"docutils literal\"><span class=\"pre\">POST</span></tt> body.</p>\n<p>Most values are encoded strings, or unicode strings when charset is set.\nThere may also be FieldStorage objects representing file uploads. If this is\nnot a POST request, or the body is not encoded fields (e.g., an XMLRPC\nrequest) then this will be empty.</p>\n<p>This will consume wsgi.input when first accessed if applicable, but the raw\nversion will be put in environ[&#8216;paste.parsed_formvars&#8217;].</p>\n<p>Returns a MultiDict container or a UnicodeMultiDict when charset is set.</p>\n</div>\n<div class=\"section\" id=\"cookies\">\n<h3>cookies<a class=\"headerlink\" href=\"#cookies\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>A dictionary of cookies, keyed by cookie name.</p>\n<p>Just a plain dictionary, may be empty but not None.</p>\n</div>\n<div class=\"section\" id=\"defaults\">\n<h3>defaults<a class=\"headerlink\" href=\"#defaults\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<div class=\"highlight\"><pre><span class=\"p\">{</span><span class=\"s\">&#39;errors&#39;</span><span class=\"p\">:</span> <span class=\"s\">&#39;replace&#39;</span><span class=\"p\">,</span>\n <span class=\"s\">&#39;decode_param_names&#39;</span><span class=\"p\">:</span> <span class=\"bp\">False</span><span class=\"p\">,</span>\n <span class=\"s\">&#39;charset&#39;</span><span class=\"p\">:</span> <span class=\"bp\">None</span><span class=\"p\">,</span>\n <span class=\"s\">&#39;language&#39;</span><span class=\"p\">:</span> <span class=\"s\">&#39;en-us&#39;</span><span class=\"p\">}</span>\n</pre></div>\n</div>\n<div class=\"section\" id=\"host\">\n<h3>host<a class=\"headerlink\" href=\"#host\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>The host name, as provided in <tt class=\"docutils literal\"><span class=\"pre\">HTTP_HOST</span></tt> with a fall-back to <span class=\"target\" id=\"index-0\"></span><strong class=\"xref\">SERVER_NAME</strong></p>\n</div>\n<div class=\"section\" id=\"is-xhr\">\n<h3>is_xhr<a class=\"headerlink\" href=\"#is-xhr\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Returns a boolean if <tt class=\"docutils literal\"><span class=\"pre\">X-Requested-With</span></tt> is present and is a <tt class=\"docutils literal\"><span class=\"pre\">XMLHttpRequest</span></tt></p>\n</div>\n<div class=\"section\" id=\"languages\">\n<h3>languages<a class=\"headerlink\" href=\"#languages\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Returns a (possibly empty) list of preferred languages, most preferred first.</p>\n</div>\n<div class=\"section\" id=\"params\">\n<h3>params<a class=\"headerlink\" href=\"#params\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>A dictionary-like object of keys from <tt class=\"docutils literal\"><span class=\"pre\">POST</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">GET</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">URL</span></tt> dicts</p>\n<p>Return a key value from the parameters, they are checked in the following order: POST, GET, URL</p>\n</div>\n</div>\n<div class=\"section\" id=\"additional-methods-supported\">\n<h2>Additional methods supported:<a class=\"headerlink\" href=\"#additional-methods-supported\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"section\" id=\"getlist-key\">\n<h3>getlist(key)<a class=\"headerlink\" href=\"#getlist-key\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Returns a list of all the values by that key, collected from POST, GET, URL dicts</p>\n<p>Returns a <tt class=\"xref docutils literal\"><span class=\"pre\">MultiDict</span></tt> container or a <tt class=\"xref docutils literal\"><span class=\"pre\">UnicodeMultiDict</span></tt> when <tt class=\"xref docutils literal\"><span class=\"pre\">charset</span></tt> is set.</p>\n</div>\n<div class=\"section\" id=\"urlvars\">\n<h3>urlvars<a class=\"headerlink\" href=\"#urlvars\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Return any variables matched in the URL (e.g. wsgiorg.routing_args).</p>\n</div>\n</div>\n<div class=\"section\" id=\"methods\">\n<h2>Methods<a class=\"headerlink\" href=\"#methods\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"section\" id=\"init-self-environ\">\n<h3>__init__(self, environ)<a class=\"headerlink\" href=\"#init-self-environ\" title=\"Permalink to this headline\">\u00b6</a></h3>\n</div>\n<div class=\"section\" id=\"determine-browser-charset-self\">\n<h3>determine_browser_charset(self)<a class=\"headerlink\" href=\"#determine-browser-charset-self\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Determine the encoding as specified by the browser via the Content-Type&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">charset</span> <span class=\"pre\">parameter</span></tt>, if one is set</p>\n</div>\n<div class=\"section\" id=\"match-accept-self-mimetypes\">\n<h3>match_accept(self, mimetypes)<a class=\"headerlink\" href=\"#match-accept-self-mimetypes\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Return a list of specified mime-types that the browser&#8217;s HTTP Accept header allows in the order provided.</p>\n</div>\n</div>\n</div>\n", 
   "current_page_name": "advanced_pylons/paster", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 22eca7450f501584a5038895f3cb80b5
-ETag: 3150945351
+ETag: 2254877668
 
 {
   "_id": "22eca7450f501584a5038895f3cb80b5", 
-  "_rev": "3150945351", 
+  "_rev": "2254877668", 
   "body": "<div class=\"section\" id=\"number-numbers-and-statistics-helpers\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">number</span></tt> &#8211; Numbers and statistics helpers<a class=\"headerlink\" href=\"#number-numbers-and-statistics-helpers\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"webhelpers-number\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webhelpers.number</span></tt><a class=\"headerlink\" href=\"#webhelpers-number\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.number.percent_of\">\n<!--[webhelpers.number.percent_of]--><tt class=\"descclassname\">webhelpers.number.</tt><tt class=\"descname\">percent_of</tt><big>(</big><em>part</em>, <em>whole</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.number.percent_of\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>What percent of <tt class=\"docutils literal\"><span class=\"pre\">whole</span></tt> is <tt class=\"docutils literal\"><span class=\"pre\">part</span></tt>?</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">percent_of</span><span class=\"p\">(</span><span class=\"mf\">5</span><span class=\"p\">,</span> <span class=\"mf\">100</span><span class=\"p\">)</span>\n<span class=\"go\">5.0</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">percent_of</span><span class=\"p\">(</span><span class=\"mf\">13</span><span class=\"p\">,</span> <span class=\"mf\">26</span><span class=\"p\">)</span>\n<span class=\"go\">50.0</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.number.mean\">\n<!--[webhelpers.number.mean]--><tt class=\"descclassname\">webhelpers.number.</tt><tt class=\"descname\">mean</tt><big>(</big><em>r</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.number.mean\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return the mean of a sequence of numbers.</p>\n<p>The mean is the average of all the numbers.</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">mean</span><span class=\"p\">([</span><span class=\"mf\">5</span><span class=\"p\">,</span> <span class=\"mf\">10</span><span class=\"p\">])</span>\n<span class=\"go\">7.5</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.number.median\">\n<!--[webhelpers.number.median]--><tt class=\"descclassname\">webhelpers.number.</tt><tt class=\"descname\">median</tt><big>(</big><em>r</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.number.median\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return the median of an iterable of numbers.</p>\n<p>The median is the point at which half the numbers are lower than it and\nhalf the numbers are higher.  This gives a better sense of the majority\nlevel than the mean (average) does, because the mean can be skewed by a few\nextreme numbers at either end.  For instance, say you want to calculate\nthe typical household income in a community and you&#8217;ve sampled four\nhouseholds:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">incomes</span> <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"mf\">18000</span><span class=\"p\">]</span>       <span class=\"c\"># Fast food crew</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">incomes</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"mf\">24000</span><span class=\"p\">)</span>   <span class=\"c\"># Janitor</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">incomes</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"mf\">32000</span><span class=\"p\">)</span>   <span class=\"c\"># Journeyman</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">incomes</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"mf\">44000</span><span class=\"p\">)</span>   <span class=\"c\"># Experienced journeyman</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">incomes</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"mf\">67000</span><span class=\"p\">)</span>   <span class=\"c\"># Manager</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">incomes</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"mf\">9999999</span><span class=\"p\">)</span> <span class=\"c\"># Bill Gates</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">median</span><span class=\"p\">(</span><span class=\"n\">incomes</span><span class=\"p\">)</span>\n<span class=\"go\">49500.0</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">mean</span><span class=\"p\">(</span><span class=\"n\">incomes</span><span class=\"p\">)</span>\n<span class=\"go\">1697499.8333333333</span>\n</pre></div>\n<p>The median here is somewhat close to the majority of incomes, while the\nmean is far from anybody&#8217;s income.</p>\n<blockquote>\n[20 000,\n40 000,\n60 000,\n9 999 999]</blockquote>\n<p>The median would be around 50 000, which is close to what the majority of\nrespondents make.  The average would be in the millions, which is far from\nwhat any of the respondents make.</p>\n<p>This implementation makes a temporary list of all numbers in memory.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.number.standard_deviation\">\n<!--[webhelpers.number.standard_deviation]--><tt class=\"descclassname\">webhelpers.number.</tt><tt class=\"descname\">standard_deviation</tt><big>(</big><em>r</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.number.standard_deviation\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Standard deviation, <a class=\"reference external\" href=\"http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442412\">from the Python Cookbook</a></p>\n<p>Standard deviation shows the variability within a sequence of numbers.\nA small standard deviation shows the numbers are close to the same.  A\nlarge standard deviation shows they are widely different.  In fact it\nshows how far the numbers tend to deviate from the average.  This can be\nused to detect whether the average has been skewed by a few extremely high\nor extremely low values.</p>\n<p>The following examples are taken from Wikipedia.\n<a class=\"reference external\" href=\"http://en.wikipedia.org/wiki/Standard_deviation\">http://en.wikipedia.org/wiki/Standard_deviation</a></p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">standard_deviation</span><span class=\"p\">([</span><span class=\"mf\">0</span><span class=\"p\">,</span> <span class=\"mf\">0</span><span class=\"p\">,</span> <span class=\"mf\">14</span><span class=\"p\">,</span> <span class=\"mf\">14</span><span class=\"p\">])</span> <span class=\"c\"># doctest: +ELLIPSIS</span>\n<span class=\"go\">8.082903768654761...</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">standard_deviation</span><span class=\"p\">([</span><span class=\"mf\">0</span><span class=\"p\">,</span> <span class=\"mf\">6</span><span class=\"p\">,</span> <span class=\"mf\">8</span><span class=\"p\">,</span> <span class=\"mf\">14</span><span class=\"p\">])</span> <span class=\"c\"># doctest: +ELLIPSIS</span>\n<span class=\"go\">5.773502691896258...</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">standard_deviation</span><span class=\"p\">([</span><span class=\"mf\">6</span><span class=\"p\">,</span> <span class=\"mf\">6</span><span class=\"p\">,</span> <span class=\"mf\">8</span><span class=\"p\">,</span> <span class=\"mf\">8</span><span class=\"p\">])</span>\n<span class=\"go\">1.1547005383792515</span>\n</pre></div>\n<p>(Wikipedia reports 7, 5, and 1 respectively. Some of the difference is\ndue to rounding, but the rest may be a bug?)</p>\n<div class=\"highlight\"><pre><span class=\"go\"># Fictitious average monthly temperatures in Southern California.</span>\n<span class=\"go\">#                       Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">standard_deviation</span><span class=\"p\">([</span><span class=\"mf\">70</span><span class=\"p\">,</span> <span class=\"mf\">70</span><span class=\"p\">,</span> <span class=\"mf\">70</span><span class=\"p\">,</span> <span class=\"mf\">75</span><span class=\"p\">,</span> <span class=\"mf\">80</span><span class=\"p\">,</span> <span class=\"mf\">85</span><span class=\"p\">,</span> <span class=\"mf\">90</span><span class=\"p\">,</span> <span class=\"mf\">95</span><span class=\"p\">,</span> <span class=\"mf\">90</span><span class=\"p\">,</span> <span class=\"mf\">80</span><span class=\"p\">,</span> <span class=\"mf\">75</span><span class=\"p\">,</span> <span class=\"mf\">70</span><span class=\"p\">])</span> <span class=\"c\"># doctest: +ELLIPSIS</span>\n<span class=\"go\">9.003366373785...</span>\n\n<span class=\"go\"># Fictitious average mothly temperatures in Montana.</span>\n<span class=\"go\">#                       Jan  Feb  Mar Apr May Jun Jul  Aug Sep Oct Nov Dec</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">standard_deviation</span><span class=\"p\">([</span><span class=\"o\">-</span><span class=\"mf\">32</span><span class=\"p\">,</span> <span class=\"o\">-</span><span class=\"mf\">10</span><span class=\"p\">,</span> <span class=\"mf\">20</span><span class=\"p\">,</span> <span class=\"mf\">30</span><span class=\"p\">,</span> <span class=\"mf\">60</span><span class=\"p\">,</span> <span class=\"mf\">90</span><span class=\"p\">,</span> <span class=\"mf\">100</span><span class=\"p\">,</span> <span class=\"mf\">80</span><span class=\"p\">,</span> <span class=\"mf\">60</span><span class=\"p\">,</span> <span class=\"mf\">30</span><span class=\"p\">,</span> <span class=\"mf\">10</span><span class=\"p\">,</span> <span class=\"o\">-</span><span class=\"mf\">32</span><span class=\"p\">])</span> <span class=\"c\"># doctest: +ELLIPSIS</span>\n<span class=\"go\">45.1378360405574...</span>\n</pre></div>\n<p>Most natural and random phenomena follow the normal distribution (aka the\nbell curve), which says that most values are close to average but a few are\nextreme.  E.g., most people are close to 5&#8216;9&#8221; tall but a few are very tall\nor very short.  If the data does follow the bell curve, 68% of the values\nwill be within 1 standard deviation (stdev) of the average, and 95% will be\nwithin 2 standard deviations.  So a university professor grading exams on a\ncurve might give a &#8220;C&#8221; (mediocre) grade to students within 1 stdev of the\naverage score, &#8220;B&#8221; (better than average) to those within 2 stdevs above,\nand &#8220;A&#8221; (perfect) to the 0.25% higher than 2 stdevs.  Those between 1 and 2\nstdevs below get a &#8220;D&#8221; (poor), and those below 2 stdevs... we won&#8217;t talk\nabout them.</p>\n<p>a large standard\ni.e., how far they deviate from the average.\nIf all numbers are the same, the standard deviation is zero.  If the\nnumbers are widely different from average, no matter whether above or\nbelow, the standard deviation will be high.  Most natural distributions\nfollow the bell curve and have a standard deviation of 1.</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webhelpers.number.SimpleStats\">\n<!--[webhelpers.number.SimpleStats]-->class <tt class=\"descclassname\">webhelpers.number.</tt><tt class=\"descname\">SimpleStats</tt><big>(</big><em>numeric=False</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.number.SimpleStats\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Calculate a few simple stats on data.</p>\n<p>This class calculates the minimum, maximum, and count of all the values\ngiven to it.  The values are not saved in the object.  Usage:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span> <span class=\"o\">=</span> <span class=\"n\">SimpleStats</span><span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"p\">(</span><span class=\"mf\">2</span><span class=\"p\">)</span>               <span class=\"c\"># Add one data value.</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">extend</span><span class=\"p\">([</span><span class=\"mf\">6</span><span class=\"p\">,</span> <span class=\"mf\">4</span><span class=\"p\">])</span>   <span class=\"c\"># Add several data values at once.  </span>\n</pre></div>\n<p>The statistics are available as instance attributes:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">count</span>\n<span class=\"go\">3</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">min</span>\n<span class=\"go\">2</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">max</span>\n<span class=\"go\">6</span>\n</pre></div>\n<p>Non-numeric data is also allowed:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats2</span> <span class=\"o\">=</span> <span class=\"n\">SimpleStats</span><span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats2</span><span class=\"p\">(</span><span class=\"s\">&quot;foo&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats2</span><span class=\"p\">(</span><span class=\"s\">&quot;bar&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats2</span><span class=\"o\">.</span><span class=\"n\">count</span>\n<span class=\"go\">2</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats2</span><span class=\"o\">.</span><span class=\"n\">min</span>\n<span class=\"go\">&#39;bar&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats2</span><span class=\"o\">.</span><span class=\"n\">max</span>\n<span class=\"go\">&#39;foo&#39;</span>\n</pre></div>\n<p>If the <tt class=\"docutils literal\"><span class=\"pre\">numeric</span></tt> constructor arg is true, only <tt class=\"docutils literal\"><span class=\"pre\">int</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">long</span></tt>, and \n<tt class=\"docutils literal\"><span class=\"pre\">float</span></tt> values will be accepted.  This flag is intended to enable\nadditional numeric statistics, although none are currently implemented.</p>\n<p><tt class=\"docutils literal\"><span class=\"pre\">.min</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">.max</span></tt> are <tt class=\"xref docutils literal\"><span class=\"pre\">None</span></tt> until the first data value is\nregistered.</p>\n<p>Subclasses can override <tt class=\"docutils literal\"><span class=\"pre\">._init_stats</span></tt> and <tt class=\"docutils literal\"><span class=\"pre\">._update_stats</span></tt> to add\nadditional statistics.</p>\n<dl class=\"method\">\n<dt id=\"webhelpers.number.SimpleStats.extend\">\n<!--[webhelpers.number.SimpleStats.extend]--><tt class=\"descname\">extend</tt><big>(</big><em>values</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.number.SimpleStats.extend\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Add several data values at once, akin to <tt class=\"docutils literal\"><span class=\"pre\">list.extend</span></tt>.</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webhelpers.number.Stats\">\n<!--[webhelpers.number.Stats]-->class <tt class=\"descclassname\">webhelpers.number.</tt><tt class=\"descname\">Stats</tt><a class=\"headerlink\" href=\"#webhelpers.number.Stats\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>A container for data and statistics.</p>\n<p>This class extends <tt class=\"docutils literal\"><span class=\"pre\">SimpleStats</span></tt> by calculating additional statistics,\nand by storing all data seen.  All values must be numeric (<tt class=\"docutils literal\"><span class=\"pre\">int</span></tt>,\n<tt class=\"docutils literal\"><span class=\"pre\">long</span></tt>, and/or <tt class=\"docutils literal\"><span class=\"pre\">float</span></tt>), and you must call <tt class=\"docutils literal\"><span class=\"pre\">.finish()</span></tt> to generate\nthe additional statistics.  That&#8217;s because the statistics here cannot be\ncalculated incrementally, but only after all data is known.</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span> <span class=\"o\">=</span> <span class=\"n\">Stats</span><span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">extend</span><span class=\"p\">([</span><span class=\"mf\">5</span><span class=\"p\">,</span> <span class=\"mf\">10</span><span class=\"p\">,</span> <span class=\"mf\">10</span><span class=\"p\">])</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">count</span>\n<span class=\"go\">3</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">finish</span><span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">mean</span> <span class=\"c\"># doctest: +ELLIPSIS</span>\n<span class=\"go\">8.33333333333333...</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">median</span>\n<span class=\"go\">10</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">standard_deviation</span>\n<span class=\"go\">2.8867513459481287</span>\n</pre></div>\n<p>All data is stored in a list and a set for later use:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">stats</span><span class=\"o\">.</span><span class=\"n\">list</span>\n<span class=\"go\">[5, 10, 10]</span>\n\n<span class=\"go\">&gt;&gt;  stats.set</span>\n<span class=\"go\">set([5, 10])</span>\n</pre></div>\n<p>(The double prompt &#8220;&gt;&gt;&#8221; is used to hide the example from doctest.)</p>\n<p>The stat attributes are <tt class=\"xref docutils literal\"><span class=\"pre\">None</span></tt> until you call <tt class=\"docutils literal\"><span class=\"pre\">.finish()</span></tt>.  It&#8217;s\npermissible &#8211; though not recommended &#8211; to add data after calling\n<tt class=\"docutils literal\"><span class=\"pre\">.finish()</span></tt> and then call <tt class=\"docutils literal\"><span class=\"pre\">.finish()</span></tt> again.  This recalculates the\nstats over the entire data set.</p>\n<p>The <tt class=\"docutils literal\"><span class=\"pre\">SimpleStats</span></tt> hook methods are available for subclasses, and \nadditionally the <tt class=\"docutils literal\"><span class=\"pre\">._finish_stats</span></tt> method.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.number.format_number\">\n<!--[webhelpers.number.format_number]--><tt class=\"descclassname\">webhelpers.number.</tt><tt class=\"descname\">format_number</tt><big>(</big><em>n</em>, <em>thousands='</em>, <em>'</em>, <em>decimal='.'</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.number.format_number\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Format a number with a thousands separator and decimal delimeter.</p>\n<p><tt class=\"docutils literal\"><span class=\"pre\">n</span></tt> may be an int, long, float, or numeric string.\n<tt class=\"docutils literal\"><span class=\"pre\">thousands</span></tt> is a separator to put after each thousand.\n<tt class=\"docutils literal\"><span class=\"pre\">decimal</span></tt> is the delimiter to put before the fractional portion if any.</p>\n<p>The default style has a thousands comma and decimal point per American\nusage:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">format_number</span><span class=\"p\">(</span><span class=\"mf\">1234567.89</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1,234,567.89&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">format_number</span><span class=\"p\">(</span><span class=\"mf\">123456</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;123,456&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">format_number</span><span class=\"p\">(</span><span class=\"o\">-</span><span class=\"mf\">123</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;-123&#39;</span>\n</pre></div>\n<p>Various European and international styles are also possible:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">format_number</span><span class=\"p\">(</span><span class=\"mf\">1234567.89</span><span class=\"p\">,</span> <span class=\"s\">&quot; &quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1 234 567.89&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">format_number</span><span class=\"p\">(</span><span class=\"mf\">1234567.89</span><span class=\"p\">,</span> <span class=\"s\">&quot; &quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;,&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1 234 567,89&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">format_number</span><span class=\"p\">(</span><span class=\"mf\">1234567.89</span><span class=\"p\">,</span> <span class=\"s\">&quot;.&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;,&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;1.234.567,89&#39;</span>\n</pre></div>\n</dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "thirdparty/webhelpers/number", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 26ab9527e5ac7908e0ae8a7abe4877d1
-ETag: 977912025
+ETag: 421303779
 
 {
   "_id": "26ab9527e5ac7908e0ae8a7abe4877d1", 
-  "_rev": "977912025", 
+  "_rev": "421303779", 
   "body": "<div class=\"section\" id=\"id1\">\n<span id=\"third-party-components\"></span><h1>Third-party components<a class=\"headerlink\" href=\"#id1\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<ul>\n<li><a class=\"reference external\" href=\"beaker/\"><tt class=\"docutils literal\"><span class=\"pre\">beaker</span></tt> &#8211; Beaker Caching</a></li>\n</ul>\n<ul>\n<li><a class=\"reference external\" href=\"formencode_api/\">FormEncode</a></li>\n</ul>\n<ul>\n<li><a class=\"reference external\" href=\"routes/\"><tt class=\"docutils literal\"><span class=\"pre\">routes</span></tt> &#8211; Route and Mapper core classes</a></li>\n</ul>\n<ul>\n<li><a class=\"reference external\" href=\"weberror/\"><tt class=\"docutils literal\"><span class=\"pre\">weberror</span></tt> &#8211; Weberror</a></li>\n</ul>\n<ul>\n<li><a class=\"reference external\" href=\"webhelpers/\"><tt class=\"docutils literal\"><span class=\"pre\">webhelpers</span></tt> &#8211; Web Helpers package</a></li>\n</ul>\n<ul>\n<li><a class=\"reference external\" href=\"webob/\"><tt class=\"docutils literal\"><span class=\"pre\">webob</span></tt> &#8211; WebOb</a></li>\n</ul>\n</div>\n", 
   "current_page_name": "thirdparty/index", 
   "display_toc": false, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 2bc846a299f3fa5bd498db944a8947a8
-ETag: 4017537576
+ETag: 2062067597
 
 {
   "_id": "2bc846a299f3fa5bd498db944a8947a8", 
-  "_rev": "4017537576", 
+  "_rev": "2062067597", 
   "body": "<div class=\"section\" id=\"beaker-beaker-caching\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">beaker</span></tt> &#8211; Beaker Caching<a class=\"headerlink\" href=\"#beaker-beaker-caching\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"module-beaker.cache\">\n<h2>Cache<a class=\"headerlink\" href=\"#module-beaker.cache\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Cache object</p>\n<p>The Cache object is used to manage a set of cache files and their\nassociated backend. The backends can be rotated on the fly by\nspecifying an alternate type when used.</p>\n<dl class=\"class\">\n<dt id=\"beaker.cache.Cache\">\n<!--[beaker.cache.Cache]-->class <tt class=\"descclassname\">beaker.cache.</tt><tt class=\"descname\">Cache</tt><big>(</big><em>namespace</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#beaker.cache.Cache\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Front-end to the containment API implementing a data cache.</p>\n<dl class=\"method\">\n<dt id=\"beaker.cache.Cache.clear\">\n<!--[beaker.cache.Cache.clear]--><tt class=\"descname\">clear</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#beaker.cache.Cache.clear\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>clear this Cache&#8217;s default namespace, as well as any other \nNamespaces that have been referenced by this Cache.</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.cache.CacheManager\">\n<!--[beaker.cache.CacheManager]-->class <tt class=\"descclassname\">beaker.cache.</tt><tt class=\"descname\">CacheManager</tt><big>(</big><em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#beaker.cache.CacheManager\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-beaker.container\">\n<h2>Container<a class=\"headerlink\" href=\"#module-beaker.container\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Container and Namespace classes</p>\n<dl class=\"class\">\n<dt id=\"beaker.container.ContainerContext\">\n<!--[beaker.container.ContainerContext]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">ContainerContext</tt><a class=\"headerlink\" href=\"#beaker.container.ContainerContext\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Initial context supplied to Containers.</p>\n<p>Keeps track of namespacemangers keyed off of namespace names and\ncontainer types.</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.container.Container\">\n<!--[beaker.container.Container]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">Container</tt><a class=\"headerlink\" href=\"#beaker.container.Container\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.container.MemoryContainer\">\n<!--[beaker.container.MemoryContainer]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">MemoryContainer</tt><a class=\"headerlink\" href=\"#beaker.container.MemoryContainer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.container.DBMContainer\">\n<!--[beaker.container.DBMContainer]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">DBMContainer</tt><a class=\"headerlink\" href=\"#beaker.container.DBMContainer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.container.NamespaceManager\">\n<!--[beaker.container.NamespaceManager]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">NamespaceManager</tt><big>(</big><em>namespace</em><big>)</big><a class=\"headerlink\" href=\"#beaker.container.NamespaceManager\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Handles dictionary operations and locking for a namespace of\nvalues.</p>\n<p>The implementation for setting and retrieving the namespace data is\nhandled by subclasses.</p>\n<p>NamespaceManager may be used alone, or may be privately accessed by\none or more Container objects.  Container objects provide per-key\nservices like expiration times and automatic recreation of values.</p>\n<p>Multiple NamespaceManagers created with a particular name will all\nshare access to the same underlying datasource and will attempt to\nsynchronize against a common mutex object.  The scope of this\nsharing may be within a single process or across multiple\nprocesses, depending on the type of NamespaceManager used.</p>\n<p>The NamespaceManager itself is generally threadsafe, except in the\ncase of the DBMNamespaceManager in conjunction with the gdbm dbm\nimplementation.</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.container.MemoryNamespaceManager\">\n<!--[beaker.container.MemoryNamespaceManager]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">MemoryNamespaceManager</tt><big>(</big><em>namespace</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#beaker.container.MemoryNamespaceManager\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.container.DBMNamespaceManager\">\n<!--[beaker.container.DBMNamespaceManager]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">DBMNamespaceManager</tt><big>(</big><em>namespace</em>, <em>dbmmodule=None</em>, <em>data_dir=None</em>, <em>dbm_dir=None</em>, <em>lock_dir=None</em>, <em>digest_filenames=True</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#beaker.container.DBMNamespaceManager\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.container.FileContainer\">\n<!--[beaker.container.FileContainer]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">FileContainer</tt><a class=\"headerlink\" href=\"#beaker.container.FileContainer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.container.FileNamespaceManager\">\n<!--[beaker.container.FileNamespaceManager]-->class <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">FileNamespaceManager</tt><big>(</big><em>namespace</em>, <em>data_dir=None</em>, <em>file_dir=None</em>, <em>lock_dir=None</em>, <em>digest_filenames=True</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#beaker.container.FileNamespaceManager\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"exception\">\n<dt id=\"beaker.container.CreationAbortedError\">\n<!--[beaker.container.CreationAbortedError]-->exception <tt class=\"descclassname\">beaker.container.</tt><tt class=\"descname\">CreationAbortedError</tt><a class=\"headerlink\" href=\"#beaker.container.CreationAbortedError\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>an exception that allows a creation function to abort what it&#8217;s\ndoing</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-beaker.ext.database\">\n<h2>Database<a class=\"headerlink\" href=\"#module-beaker.ext.database\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"beaker.ext.database.DatabaseNamespaceManager\">\n<!--[beaker.ext.database.DatabaseNamespaceManager]-->class <tt class=\"descclassname\">beaker.ext.database.</tt><tt class=\"descname\">DatabaseNamespaceManager</tt><big>(</big><em>namespace</em>, <em>url=None</em>, <em>sa_opts=None</em>, <em>optimistic=False</em>, <em>table_name='beaker_cache'</em>, <em>data_dir=None</em>, <em>lock_dir=None</em>, <em>**params</em><big>)</big><a class=\"headerlink\" href=\"#beaker.ext.database.DatabaseNamespaceManager\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.ext.database.DatabaseContainer\">\n<!--[beaker.ext.database.DatabaseContainer]-->class <tt class=\"descclassname\">beaker.ext.database.</tt><tt class=\"descname\">DatabaseContainer</tt><a class=\"headerlink\" href=\"#beaker.ext.database.DatabaseContainer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-beaker.ext.google\">\n<h2>Google<a class=\"headerlink\" href=\"#module-beaker.ext.google\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"beaker.ext.google.GoogleNamespaceManager\">\n<!--[beaker.ext.google.GoogleNamespaceManager]-->class <tt class=\"descclassname\">beaker.ext.google.</tt><tt class=\"descname\">GoogleNamespaceManager</tt><big>(</big><em>namespace</em>, <em>table_name='beaker_cache'</em>, <em>**params</em><big>)</big><a class=\"headerlink\" href=\"#beaker.ext.google.GoogleNamespaceManager\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.ext.google.GoogleContainer\">\n<!--[beaker.ext.google.GoogleContainer]-->class <tt class=\"descclassname\">beaker.ext.google.</tt><tt class=\"descname\">GoogleContainer</tt><a class=\"headerlink\" href=\"#beaker.ext.google.GoogleContainer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-beaker.middleware\">\n<h2>Memcached<a class=\"headerlink\" href=\"#module-beaker.middleware\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"beaker.ext.memcached.MemcachedNamespaceManager\">\n<!--[beaker.ext.memcached.MemcachedNamespaceManager]-->class <tt class=\"descclassname\">beaker.ext.memcached.</tt><tt class=\"descname\">MemcachedNamespaceManager</tt><big>(</big><em>namespace</em>, <em>url</em>, <em>data_dir=None</em>, <em>lock_dir=None</em>, <em>**params</em><big>)</big><a class=\"headerlink\" href=\"#beaker.ext.memcached.MemcachedNamespaceManager\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.ext.memcached.MemcachedContainer\">\n<!--[beaker.ext.memcached.MemcachedContainer]-->class <tt class=\"descclassname\">beaker.ext.memcached.</tt><tt class=\"descname\">MemcachedContainer</tt><a class=\"headerlink\" href=\"#beaker.ext.memcached.MemcachedContainer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<p>Middleware</p>\n<dl class=\"class\">\n<dt id=\"beaker.middleware.CacheMiddleware\">\n<!--[beaker.middleware.CacheMiddleware]-->class <tt class=\"descclassname\">beaker.middleware.</tt><tt class=\"descname\">CacheMiddleware</tt><big>(</big><em>app</em>, <em>config=None</em>, <em>environ_key='beaker.cache'</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#beaker.middleware.CacheMiddleware\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.middleware.SessionMiddleware\">\n<!--[beaker.middleware.SessionMiddleware]-->class <tt class=\"descclassname\">beaker.middleware.</tt><tt class=\"descname\">SessionMiddleware</tt><big>(</big><em>wrap_app</em>, <em>config=None</em>, <em>environ_key='beaker.session'</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#beaker.middleware.SessionMiddleware\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-beaker.session\">\n<h2>Session<a class=\"headerlink\" href=\"#module-beaker.session\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"beaker.session.SignedCookie\">\n<!--[beaker.session.SignedCookie]-->class <tt class=\"descclassname\">beaker.session.</tt><tt class=\"descname\">SignedCookie</tt><big>(</big><em>secret</em>, <em>input=None</em><big>)</big><a class=\"headerlink\" href=\"#beaker.session.SignedCookie\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Extends python cookie to give digital signature support</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.session.Session\">\n<!--[beaker.session.Session]-->class <tt class=\"descclassname\">beaker.session.</tt><tt class=\"descname\">Session</tt><big>(</big><em>request</em>, <em>id=None</em>, <em>invalidate_corrupt=False</em>, <em>use_cookies=True</em>, <em>type=None</em>, <em>data_dir=None</em>, <em>key='beaker.session.id'</em>, <em>timeout=None</em>, <em>cookie_expires=True</em>, <em>cookie_domain=None</em>, <em>secret=None</em>, <em>secure=False</em>, <em>namespace_class=None</em>, <em>**namespace_args</em><big>)</big><a class=\"headerlink\" href=\"#beaker.session.Session\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Session object that uses container package for storage</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.session.SessionObject\">\n<!--[beaker.session.SessionObject]-->class <tt class=\"descclassname\">beaker.session.</tt><tt class=\"descname\">SessionObject</tt><big>(</big><em>environ</em>, <em>**params</em><big>)</big><a class=\"headerlink\" href=\"#beaker.session.SessionObject\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Session proxy/lazy creator</p>\n<p>This object proxies access to the actual session object, so that in\nthe case that the session hasn&#8217;t been used before, it will be\nsetup. This avoid creating and loading the session from persistent\nstorage unless its actually used during the request.</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-beaker.synchronization\">\n<h2>Synchronization<a class=\"headerlink\" href=\"#module-beaker.synchronization\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Synchronization module for keeping state of values in sync</p>\n<dl class=\"class\">\n<dt id=\"beaker.synchronization.NameLock\">\n<!--[beaker.synchronization.NameLock]-->class <tt class=\"descclassname\">beaker.synchronization.</tt><tt class=\"descname\">NameLock</tt><big>(</big><em>identifier=None</em>, <em>reentrant=False</em><big>)</big><a class=\"headerlink\" href=\"#beaker.synchronization.NameLock\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>a proxy for an RLock object that is stored in a name based\nregistry.</p>\n<p>Multiple threads can get a reference to the same RLock based on the\nname alone, and synchronize operations related to that name.</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.synchronization.SynchronizerImpl\">\n<!--[beaker.synchronization.SynchronizerImpl]-->class <tt class=\"descclassname\">beaker.synchronization.</tt><tt class=\"descname\">SynchronizerImpl</tt><a class=\"headerlink\" href=\"#beaker.synchronization.SynchronizerImpl\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.synchronization.FileSynchronizer\">\n<!--[beaker.synchronization.FileSynchronizer]-->class <tt class=\"descclassname\">beaker.synchronization.</tt><tt class=\"descname\">FileSynchronizer</tt><big>(</big><em>identifier</em>, <em>lock_dir</em><big>)</big><a class=\"headerlink\" href=\"#beaker.synchronization.FileSynchronizer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>a synchronizer which locks using flock().</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.synchronization.ConditionSynchronizer\">\n<!--[beaker.synchronization.ConditionSynchronizer]-->class <tt class=\"descclassname\">beaker.synchronization.</tt><tt class=\"descname\">ConditionSynchronizer</tt><big>(</big><em>identifier</em><big>)</big><a class=\"headerlink\" href=\"#beaker.synchronization.ConditionSynchronizer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>a synchronizer using a Condition.</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-beaker.util\">\n<h2>Util<a class=\"headerlink\" href=\"#module-beaker.util\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Beaker utilities</p>\n<dl class=\"class\">\n<dt id=\"beaker.util.SyncDict\">\n<!--[beaker.util.SyncDict]-->class <tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">SyncDict</tt><a class=\"headerlink\" href=\"#beaker.util.SyncDict\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>An efficient/threadsafe singleton map algorithm, a.k.a.\n&#8220;get a value based on this key, and create if not found or not\nvalid&#8221; paradigm:</p>\n<blockquote>\nexists &amp;&amp; isvalid ? get : create</blockquote>\n<p>Works with weakref dictionaries and the LRUCache to handle items\nasynchronously disappearing from the dictionary.</p>\n<p>Use python 2.3.3 or greater !  a major bug was just fixed in Nov.\n2003 that was driving me nuts with garbage collection/weakrefs in\nthis section.</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.util.WeakValuedRegistry\">\n<!--[beaker.util.WeakValuedRegistry]-->class <tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">WeakValuedRegistry</tt><a class=\"headerlink\" href=\"#beaker.util.WeakValuedRegistry\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"beaker.util.ThreadLocal\">\n<!--[beaker.util.ThreadLocal]-->class <tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">ThreadLocal</tt><a class=\"headerlink\" href=\"#beaker.util.ThreadLocal\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>stores a value on a per-thread basis</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"beaker.util.b64decode\">\n<!--[beaker.util.b64decode]--><tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">b64decode</tt><big>(</big><em>s</em>, <em>altchars=None</em><big>)</big><a class=\"headerlink\" href=\"#beaker.util.b64decode\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Decode a Base64 encoded string.</p>\n<p>s is the string to decode.  Optional altchars must be a string of at least\nlength 2 (additional characters are ignored) which specifies the\nalternative alphabet used instead of the &#8216;+&#8217; and &#8216;/&#8217; characters.</p>\n<p>The decoded string is returned.  A TypeError is raised if s were\nincorrectly padded or if there are non-alphabet characters present in the\nstring.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"beaker.util.b64encode\">\n<!--[beaker.util.b64encode]--><tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">b64encode</tt><big>(</big><em>s</em>, <em>altchars=None</em><big>)</big><a class=\"headerlink\" href=\"#beaker.util.b64encode\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Encode a string using Base64.</p>\n<p>s is the string to encode.  Optional altchars must be a string of at least\nlength 2 (additional characters are ignored) which specifies an\nalternative alphabet for the &#8216;+&#8217; and &#8216;/&#8217; characters.  This allows an\napplication to e.g. generate url or filesystem safe Base64 strings.</p>\n<p>The encoded string is returned.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"beaker.util.verify_directory\">\n<!--[beaker.util.verify_directory]--><tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">verify_directory</tt><big>(</big><em>dir</em><big>)</big><a class=\"headerlink\" href=\"#beaker.util.verify_directory\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>verifies and creates a directory.  tries to\nignore collisions with other threads and processes.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"beaker.util.encoded_path\">\n<!--[beaker.util.encoded_path]--><tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">encoded_path</tt><big>(</big><em>root</em>, <em>identifiers</em>, <em>extension='.enc'</em>, <em>depth=3</em>, <em>digest_filenames=True</em><big>)</big><a class=\"headerlink\" href=\"#beaker.util.encoded_path\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Generate a unique file-accessible path from the given list of\nidentifiers starting at the given root directory.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"beaker.util.verify_options\">\n<!--[beaker.util.verify_options]--><tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">verify_options</tt><big>(</big><em>opt</em>, <em>types</em>, <em>error</em><big>)</big><a class=\"headerlink\" href=\"#beaker.util.verify_options\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"beaker.util.verify_rules\">\n<!--[beaker.util.verify_rules]--><tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">verify_rules</tt><big>(</big><em>params</em>, <em>ruleset</em><big>)</big><a class=\"headerlink\" href=\"#beaker.util.verify_rules\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"beaker.util.coerce_session_params\">\n<!--[beaker.util.coerce_session_params]--><tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">coerce_session_params</tt><big>(</big><em>params</em><big>)</big><a class=\"headerlink\" href=\"#beaker.util.coerce_session_params\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"beaker.util.coerce_cache_params\">\n<!--[beaker.util.coerce_cache_params]--><tt class=\"descclassname\">beaker.util.</tt><tt class=\"descname\">coerce_cache_params</tt><big>(</big><em>params</em><big>)</big><a class=\"headerlink\" href=\"#beaker.util.coerce_cache_params\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "thirdparty/beaker", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 31c6674ef25a782f5a694c3d1ba8c881
-ETag: 2215552406
+ETag: 1927282845
 
 {
   "_id": "31c6674ef25a782f5a694c3d1ba8c881", 
-  "_rev": "2215552406", 
+  "_rev": "1927282845", 
   "body": "<div class=\"section\" id=\"module-pylons.decorators.secure\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">pylons.decorators.secure</span></tt> &#8211; Secure Decorators<a class=\"headerlink\" href=\"#module-pylons.decorators.secure\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<p>Security related decorators</p>\n<div class=\"section\" id=\"module-contents\">\n<h2>Module Contents<a class=\"headerlink\" href=\"#module-contents\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"pylons.decorators.secure.authenticate_form\">\n<!--[pylons.decorators.secure.authenticate_form]--><tt class=\"descclassname\">pylons.decorators.secure.</tt><tt class=\"descname\">authenticate_form</tt><big>(</big><em>func</em><big>)</big><a class=\"headerlink\" href=\"#pylons.decorators.secure.authenticate_form\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Decorator for authenticating a form</p>\n<p>This decorator uses an authorization token stored in the client&#8217;s\nsession for prevention of certain Cross-site request forgery (CSRF)\nattacks (See\n<a class=\"reference external\" href=\"http://en.wikipedia.org/wiki/Cross-site_request_forgery\">http://en.wikipedia.org/wiki/Cross-site_request_forgery</a> for more\ninformation).</p>\n<p>For use with the <tt class=\"docutils literal\"><span class=\"pre\">webhelpers.html.secure_form</span></tt> helper functions.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"pylons.decorators.secure.https\">\n<!--[pylons.decorators.secure.https]--><tt class=\"descclassname\">pylons.decorators.secure.</tt><tt class=\"descname\">https</tt><big>(</big><em>*redirect_args</em>, <em>**redirect_kwargs</em><big>)</big><a class=\"headerlink\" href=\"#pylons.decorators.secure.https\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Decorator to redirect to the SSL version of a page if not currently\nusing HTTPS. Takes as arguments the parameters to pass to redirect_to.\n(Specify no arguments necessary to redirect the current page).  Apply this\ndecorator to controller methods (actions).</p>\n<p>Non-https POST requests are aborted (405 response code) by this decorator.</p>\n<p>Example:</p>\n<pre>@https('/pylons') # redirect to HTTPS /pylons\ndef index(self):\n    #...\n\n# redirect to HTTPS /auth/login\n@https(controller='auth', action='login')\ndef login(self):\n    #...\n\n@https() # redirect to HTTPS version of myself\ndef get(self):\n    #...</pre>\n</dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "modules/decorators_secure", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 35ec2685e48919ca2cfb06f0dd7f12e1
-ETag: 1769518112
+ETag: 2346110782
 
 {
   "_id": "35ec2685e48919ca2cfb06f0dd7f12e1", 
-  "_rev": "1769518112", 
+  "_rev": "2346110782", 
   "body": "<div class=\"section\" id=\"module-webob\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">webob</span></tt> &#8211; WebOb<a class=\"headerlink\" href=\"#module-webob\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<dl class=\"class\">\n<dt id=\"webob.Request\">\n<!--[webob.Request]-->class <tt class=\"descclassname\">webob.</tt><tt class=\"descname\">Request</tt><big>(</big><em>environ=None</em>, <em>environ_getter=None</em>, <em>charset=(No Default)</em>, <em>unicode_errors=(No Default)</em>, <em>decode_param_names=(No Default)</em>, <em>**kw</em><big>)</big><a class=\"headerlink\" href=\"#webob.Request\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><dl class=\"attribute\">\n<dt id=\"webob.Request.GET\">\n<!--[webob.Request.GET]--><tt class=\"descname\">GET</tt><a class=\"headerlink\" href=\"#webob.Request.GET\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Like <tt class=\"docutils literal\"><span class=\"pre\">.str_GET</span></tt>, but may decode values and keys</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.POST\">\n<!--[webob.Request.POST]--><tt class=\"descname\">POST</tt><a class=\"headerlink\" href=\"#webob.Request.POST\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Like <tt class=\"docutils literal\"><span class=\"pre\">.str_POST</span></tt>, but may decode values and keys</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.ResponseClass\">\n<!--[webob.Request.ResponseClass]--><tt class=\"descname\">ResponseClass</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.Request.ResponseClass\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a WSGI response</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.accept\">\n<!--[webob.Request.accept]--><tt class=\"descname\">accept</tt><a class=\"headerlink\" href=\"#webob.Request.accept\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_ACCEPT&#8217; key from the environment.  For more information on Accept see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1\">section 14.1</a>.  Converts it as a MIME Accept.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.accept_charset\">\n<!--[webob.Request.accept_charset]--><tt class=\"descname\">accept_charset</tt><a class=\"headerlink\" href=\"#webob.Request.accept_charset\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_ACCEPT_CHARSET&#8217; key from the environment.  For more information on Accept-Charset see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2\">section 14.2</a>.  Converts it as a accept header.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.accept_encoding\">\n<!--[webob.Request.accept_encoding]--><tt class=\"descname\">accept_encoding</tt><a class=\"headerlink\" href=\"#webob.Request.accept_encoding\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_ACCEPT_ENCODING&#8217; key from the environment.  For more information on Accept-Encoding see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3\">section 14.3</a>.  Converts it as a accept header.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.accept_language\">\n<!--[webob.Request.accept_language]--><tt class=\"descname\">accept_language</tt><a class=\"headerlink\" href=\"#webob.Request.accept_language\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_ACCEPT_LANGUAGE&#8217; key from the environment.  For more information on Accept-Language see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4\">section 14.4</a>.  Converts it as a accept header.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.application_url\">\n<!--[webob.Request.application_url]--><tt class=\"descname\">application_url</tt><a class=\"headerlink\" href=\"#webob.Request.application_url\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The URL including SCRIPT_NAME (no PATH_INFO or query string)</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.blank\">\n<!--[webob.Request.blank]--><tt class=\"descname\">blank</tt><a class=\"headerlink\" href=\"#webob.Request.blank\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Create a blank request environ (and Request wrapper) with the\ngiven path (path should be urlencoded), and any keys from\nenviron.</p>\n<p>The path will become path_info, with any query string split\noff and used.</p>\n<p>All necessary keys will be added to the environ, but the\nvalues you pass in will take precedence.  If you pass in\nbase_url then wsgi.url_scheme, HTTP_HOST, and SCRIPT_NAME will\nbe filled in from that value.</p>\n<p>Any extra keyword will be passed to <tt class=\"docutils literal\"><span class=\"pre\">__init__</span></tt> (e.g.,\n<tt class=\"docutils literal\"><span class=\"pre\">decode_param_names</span></tt>).</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.body\">\n<!--[webob.Request.body]--><tt class=\"descname\">body</tt><a class=\"headerlink\" href=\"#webob.Request.body\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return the content of the request body.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.body_file\">\n<!--[webob.Request.body_file]--><tt class=\"descname\">body_file</tt><a class=\"headerlink\" href=\"#webob.Request.body_file\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Access the body of the request (wsgi.input) as a file-like\nobject.</p>\n<p>If you set this value, CONTENT_LENGTH will also be updated\n(either set to -1, 0 if you delete the attribute, or if you\nset the attribute to a string then the length of the string).</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.cache_control\">\n<!--[webob.Request.cache_control]--><tt class=\"descname\">cache_control</tt><a class=\"headerlink\" href=\"#webob.Request.cache_control\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Get/set/modify the Cache-Control header (section <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9\">14.9</a>)</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.call_application\">\n<!--[webob.Request.call_application]--><tt class=\"descname\">call_application</tt><big>(</big><em>application</em>, <em>catch_exc_info=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.Request.call_application\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Call the given WSGI application, returning <tt class=\"docutils literal\"><span class=\"pre\">(status_string,</span>\n<span class=\"pre\">headerlist,</span> <span class=\"pre\">app_iter)</span></tt></p>\n<p>Be sure to call <tt class=\"docutils literal\"><span class=\"pre\">app_iter.close()</span></tt> if it&#8217;s there.</p>\n<p>If catch_exc_info is true, then returns <tt class=\"docutils literal\"><span class=\"pre\">(status_string,</span>\n<span class=\"pre\">headerlist,</span> <span class=\"pre\">app_iter,</span> <span class=\"pre\">exc_info)</span></tt>, where the fourth item may\nbe None, but won&#8217;t be if there was an exception.  If you don&#8217;t\ndo this and there was an exception, the exception will be\nraised directly.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.content_length\">\n<!--[webob.Request.content_length]--><tt class=\"descname\">content_length</tt><a class=\"headerlink\" href=\"#webob.Request.content_length\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;CONTENT_LENGTH&#8217; key from the environment.  For more information on CONTENT_LENGTH see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13\">section 14.13</a>.  Converts it as a int.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.content_type\">\n<!--[webob.Request.content_type]--><tt class=\"descname\">content_type</tt><a class=\"headerlink\" href=\"#webob.Request.content_type\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;CONTENT_TYPE&#8217; key from the environment.  For more information on CONTENT_TYPE see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17\">section 14.17</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.cookies\">\n<!--[webob.Request.cookies]--><tt class=\"descname\">cookies</tt><a class=\"headerlink\" href=\"#webob.Request.cookies\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Like <tt class=\"docutils literal\"><span class=\"pre\">.str_cookies</span></tt>, but may decode values and keys</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.copy\">\n<!--[webob.Request.copy]--><tt class=\"descname\">copy</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.Request.copy\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Copy the request and environment object.</p>\n<p>This only does a shallow copy, except of wsgi.input</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.copy_body\">\n<!--[webob.Request.copy_body]--><tt class=\"descname\">copy_body</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.Request.copy_body\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Copies the body, in cases where it might be shared with\nanother request object and that is not desired.</p>\n<p>This copies the body in-place, either into a StringIO object\nor a temporary file.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.copy_get\">\n<!--[webob.Request.copy_get]--><tt class=\"descname\">copy_get</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.Request.copy_get\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Copies the request and environment object, but turning this request\ninto a GET along the way.  If this was a POST request (or any other verb)\nthen it becomes GET, and the request body is thrown away.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.date\">\n<!--[webob.Request.date]--><tt class=\"descname\">date</tt><a class=\"headerlink\" href=\"#webob.Request.date\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_DATE&#8217; key from the environment.  For more information on Date see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8\">section 14.8</a>.  Converts it as a HTTP date.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.environ\">\n<!--[webob.Request.environ]--><tt class=\"descname\">environ</tt><a class=\"headerlink\" href=\"#webob.Request.environ\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The WSGI environment dictionary for this request</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.get_response\">\n<!--[webob.Request.get_response]--><tt class=\"descname\">get_response</tt><big>(</big><em>application</em>, <em>catch_exc_info=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.Request.get_response\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Like <tt class=\"docutils literal\"><span class=\"pre\">.call_application(application)</span></tt>, except returns a\nresponse object with <tt class=\"docutils literal\"><span class=\"pre\">.status</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">.headers</span></tt>, and <tt class=\"docutils literal\"><span class=\"pre\">.body</span></tt>\nattributes.</p>\n<p>This will use <tt class=\"docutils literal\"><span class=\"pre\">self.ResponseClass</span></tt> to figure out the class\nof the response object to return.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.headers\">\n<!--[webob.Request.headers]--><tt class=\"descname\">headers</tt><a class=\"headerlink\" href=\"#webob.Request.headers\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>All the request headers as a case-insensitive dictionary-like\nobject.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.host\">\n<!--[webob.Request.host]--><tt class=\"descname\">host</tt><a class=\"headerlink\" href=\"#webob.Request.host\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Host name provided in HTTP_HOST, with fall-back to SERVER_NAME</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.host_url\">\n<!--[webob.Request.host_url]--><tt class=\"descname\">host_url</tt><a class=\"headerlink\" href=\"#webob.Request.host_url\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The URL through the host (no path)</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.if_match\">\n<!--[webob.Request.if_match]--><tt class=\"descname\">if_match</tt><a class=\"headerlink\" href=\"#webob.Request.if_match\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_IF_MATCH&#8217; key from the environment.  For more information on If-Match see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24\">section 14.24</a>.  Converts it as a ETag.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.if_modified_since\">\n<!--[webob.Request.if_modified_since]--><tt class=\"descname\">if_modified_since</tt><a class=\"headerlink\" href=\"#webob.Request.if_modified_since\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_IF_MODIFIED_SINCE&#8217; key from the environment.  For more information on If-Modified-Since see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25\">section 14.25</a>.  Converts it as a HTTP date.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.if_none_match\">\n<!--[webob.Request.if_none_match]--><tt class=\"descname\">if_none_match</tt><a class=\"headerlink\" href=\"#webob.Request.if_none_match\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_IF_NONE_MATCH&#8217; key from the environment.  For more information on If-None-Match see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26\">section 14.26</a>.  Converts it as a ETag.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.if_range\">\n<!--[webob.Request.if_range]--><tt class=\"descname\">if_range</tt><a class=\"headerlink\" href=\"#webob.Request.if_range\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_IF_RANGE&#8217; key from the environment.  For more information on If-Range see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.27\">section 14.27</a>.  Converts it as a IfRange object.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.if_unmodified_since\">\n<!--[webob.Request.if_unmodified_since]--><tt class=\"descname\">if_unmodified_since</tt><a class=\"headerlink\" href=\"#webob.Request.if_unmodified_since\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_IF_UNMODIFIED_SINCE&#8217; key from the environment.  For more information on If-Unmodified-Since see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.28\">section 14.28</a>.  Converts it as a HTTP date.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.is_xhr\">\n<!--[webob.Request.is_xhr]--><tt class=\"descname\">is_xhr</tt><a class=\"headerlink\" href=\"#webob.Request.is_xhr\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Returns a boolean if X-Requested-With is present and <tt class=\"docutils literal\"><span class=\"pre\">XMLHttpRequest</span></tt></p>\n<p>Note: this isn&#8217;t set by every XMLHttpRequest request, it is\nonly set if you are using a Javascript library that sets it\n(or you set the header yourself manually).  Currently\nPrototype and jQuery are known to set this header.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.make_body_seekable\">\n<!--[webob.Request.make_body_seekable]--><tt class=\"descname\">make_body_seekable</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.Request.make_body_seekable\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>This forces <tt class=\"docutils literal\"><span class=\"pre\">environ['wsgi.input']</span></tt> to be seekable.  That\nis, if it doesn&#8217;t have a <cite>seek</cite> method already, the content is\ncopied into a StringIO or temporary file.</p>\n<p>The choice to copy to StringIO is made from\n<tt class=\"docutils literal\"><span class=\"pre\">self.request_body_tempfile_limit</span></tt></p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.max_forwards\">\n<!--[webob.Request.max_forwards]--><tt class=\"descname\">max_forwards</tt><a class=\"headerlink\" href=\"#webob.Request.max_forwards\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_MAX_FORWARDS&#8217; key from the environment.  For more information on Max-Forwards see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.31\">section 14.31</a>.  Converts it as a int.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.method\">\n<!--[webob.Request.method]--><tt class=\"descname\">method</tt><a class=\"headerlink\" href=\"#webob.Request.method\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;REQUEST_METHOD&#8217; key from the environment.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.params\">\n<!--[webob.Request.params]--><tt class=\"descname\">params</tt><a class=\"headerlink\" href=\"#webob.Request.params\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Like <tt class=\"docutils literal\"><span class=\"pre\">.str_params</span></tt>, but may decode values and keys</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.path\">\n<!--[webob.Request.path]--><tt class=\"descname\">path</tt><a class=\"headerlink\" href=\"#webob.Request.path\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The path of the request, without host or query string</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.path_info\">\n<!--[webob.Request.path_info]--><tt class=\"descname\">path_info</tt><a class=\"headerlink\" href=\"#webob.Request.path_info\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;PATH_INFO&#8217; key from the environment.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.path_info_peek\">\n<!--[webob.Request.path_info_peek]--><tt class=\"descname\">path_info_peek</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.Request.path_info_peek\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns the next segment on PATH_INFO, or None if there is no\nnext segment.  Doesn&#8217;t modify the environment.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.path_info_pop\">\n<!--[webob.Request.path_info_pop]--><tt class=\"descname\">path_info_pop</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.Request.path_info_pop\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>&#8216;Pops&#8217; off the next segment of PATH_INFO, pushing it onto\nSCRIPT_NAME, and returning the popped segment.  Returns None if\nthere is nothing left on PATH_INFO.</p>\n<p>Does not return <tt class=\"docutils literal\"><span class=\"pre\">''</span></tt> when there&#8217;s an empty segment (like\n<tt class=\"docutils literal\"><span class=\"pre\">/path//path</span></tt>); these segments are just ignored.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.path_qs\">\n<!--[webob.Request.path_qs]--><tt class=\"descname\">path_qs</tt><a class=\"headerlink\" href=\"#webob.Request.path_qs\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The path of the request, without host but with query string</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.path_url\">\n<!--[webob.Request.path_url]--><tt class=\"descname\">path_url</tt><a class=\"headerlink\" href=\"#webob.Request.path_url\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The URL including SCRIPT_NAME and PATH_INFO, but not QUERY_STRING</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.postvars\">\n<!--[webob.Request.postvars]--><tt class=\"descname\">postvars</tt><a class=\"headerlink\" href=\"#webob.Request.postvars\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Wraps a decorator, with a deprecation warning or error</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.pragma\">\n<!--[webob.Request.pragma]--><tt class=\"descname\">pragma</tt><a class=\"headerlink\" href=\"#webob.Request.pragma\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_PRAGMA&#8217; key from the environment.  For more information on Pragma see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32\">section 14.32</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.query_string\">\n<!--[webob.Request.query_string]--><tt class=\"descname\">query_string</tt><a class=\"headerlink\" href=\"#webob.Request.query_string\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;QUERY_STRING&#8217; key from the environment.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.queryvars\">\n<!--[webob.Request.queryvars]--><tt class=\"descname\">queryvars</tt><a class=\"headerlink\" href=\"#webob.Request.queryvars\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Wraps a decorator, with a deprecation warning or error</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.range\">\n<!--[webob.Request.range]--><tt class=\"descname\">range</tt><a class=\"headerlink\" href=\"#webob.Request.range\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_RANGE&#8217; key from the environment.  For more information on Range see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35\">section 14.35</a>.  Converts it as a Range object.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.referer\">\n<!--[webob.Request.referer]--><tt class=\"descname\">referer</tt><a class=\"headerlink\" href=\"#webob.Request.referer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_REFERER&#8217; key from the environment.  For more information on Referer see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.36\">section 14.36</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.referrer\">\n<!--[webob.Request.referrer]--><tt class=\"descname\">referrer</tt><a class=\"headerlink\" href=\"#webob.Request.referrer\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_REFERER&#8217; key from the environment.  For more information on Referer see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.36\">section 14.36</a>.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.relative_url\">\n<!--[webob.Request.relative_url]--><tt class=\"descname\">relative_url</tt><big>(</big><em>other_url</em>, <em>to_application=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.Request.relative_url\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Resolve other_url relative to the request URL.</p>\n<p>If <tt class=\"docutils literal\"><span class=\"pre\">to_application</span></tt> is True, then resolve it relative to the\nURL with only SCRIPT_NAME</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.remote_addr\">\n<!--[webob.Request.remote_addr]--><tt class=\"descname\">remote_addr</tt><a class=\"headerlink\" href=\"#webob.Request.remote_addr\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;REMOTE_ADDR&#8217; key from the environment.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.remote_user\">\n<!--[webob.Request.remote_user]--><tt class=\"descname\">remote_user</tt><a class=\"headerlink\" href=\"#webob.Request.remote_user\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;REMOTE_USER&#8217; key from the environment.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Request.remove_conditional_headers\">\n<!--[webob.Request.remove_conditional_headers]--><tt class=\"descname\">remove_conditional_headers</tt><big>(</big><em>remove_encoding=True</em>, <em>remove_range=True</em>, <em>remove_match=True</em>, <em>remove_modified=True</em><big>)</big><a class=\"headerlink\" href=\"#webob.Request.remove_conditional_headers\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Remove headers that make the request conditional.</p>\n<p>These headers can cause the response to be 304 Not Modified,\nwhich in some cases you may not want to be possible.</p>\n<p>This does not remove headers like If-Match, which are used for\nconflict detection.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.scheme\">\n<!--[webob.Request.scheme]--><tt class=\"descname\">scheme</tt><a class=\"headerlink\" href=\"#webob.Request.scheme\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;wsgi.url_scheme&#8217; key from the environment.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.script_name\">\n<!--[webob.Request.script_name]--><tt class=\"descname\">script_name</tt><a class=\"headerlink\" href=\"#webob.Request.script_name\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;SCRIPT_NAME&#8217; key from the environment.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.server_name\">\n<!--[webob.Request.server_name]--><tt class=\"descname\">server_name</tt><a class=\"headerlink\" href=\"#webob.Request.server_name\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;SERVER_NAME&#8217; key from the environment.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.server_port\">\n<!--[webob.Request.server_port]--><tt class=\"descname\">server_port</tt><a class=\"headerlink\" href=\"#webob.Request.server_port\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;SERVER_PORT&#8217; key from the environment.  Converts it as a int.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.str_GET\">\n<!--[webob.Request.str_GET]--><tt class=\"descname\">str_GET</tt><a class=\"headerlink\" href=\"#webob.Request.str_GET\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return a MultiDict containing all the variables from the\nQUERY_STRING.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.str_POST\">\n<!--[webob.Request.str_POST]--><tt class=\"descname\">str_POST</tt><a class=\"headerlink\" href=\"#webob.Request.str_POST\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return a MultiDict containing all the variables from a form\nrequest. Returns an empty dict-like object for non-form\nrequests.</p>\n<p>Form requests are typically POST requests, however PUT requests\nwith an appropriate Content-Type are also supported.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.str_cookies\">\n<!--[webob.Request.str_cookies]--><tt class=\"descname\">str_cookies</tt><a class=\"headerlink\" href=\"#webob.Request.str_cookies\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return a <em>plain</em> dictionary of cookies as found in the request.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.str_params\">\n<!--[webob.Request.str_params]--><tt class=\"descname\">str_params</tt><a class=\"headerlink\" href=\"#webob.Request.str_params\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>A dictionary-like object containing both the parameters from\nthe query string and request body.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.str_postvars\">\n<!--[webob.Request.str_postvars]--><tt class=\"descname\">str_postvars</tt><a class=\"headerlink\" href=\"#webob.Request.str_postvars\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Wraps a decorator, with a deprecation warning or error</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.str_queryvars\">\n<!--[webob.Request.str_queryvars]--><tt class=\"descname\">str_queryvars</tt><a class=\"headerlink\" href=\"#webob.Request.str_queryvars\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Wraps a decorator, with a deprecation warning or error</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.url\">\n<!--[webob.Request.url]--><tt class=\"descname\">url</tt><a class=\"headerlink\" href=\"#webob.Request.url\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The full request URL, including QUERY_STRING</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.urlargs\">\n<!--[webob.Request.urlargs]--><tt class=\"descname\">urlargs</tt><a class=\"headerlink\" href=\"#webob.Request.urlargs\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return any <em>positional</em> variables matched in the URL.</p>\n<p>Takes values from <tt class=\"docutils literal\"><span class=\"pre\">environ['wsgiorg.routing_args']</span></tt>.\nSystems like <tt class=\"docutils literal\"><span class=\"pre\">routes</span></tt> set this value.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.urlvars\">\n<!--[webob.Request.urlvars]--><tt class=\"descname\">urlvars</tt><a class=\"headerlink\" href=\"#webob.Request.urlvars\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return any <em>named</em> variables matched in the URL.</p>\n<p>Takes values from <tt class=\"docutils literal\"><span class=\"pre\">environ['wsgiorg.routing_args']</span></tt>.\nSystems like <tt class=\"docutils literal\"><span class=\"pre\">routes</span></tt> set this value.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Request.user_agent\">\n<!--[webob.Request.user_agent]--><tt class=\"descname\">user_agent</tt><a class=\"headerlink\" href=\"#webob.Request.user_agent\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes the &#8216;HTTP_USER_AGENT&#8217; key from the environment.  For more information on User-Agent see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43\">section 14.43</a>.</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.Response\">\n<!--[webob.Response]-->class <tt class=\"descclassname\">webob.</tt><tt class=\"descname\">Response</tt><big>(</big><em>body=None</em>, <em>status='200 OK'</em>, <em>headerlist=None</em>, <em>app_iter=None</em>, <em>request=None</em>, <em>content_type=None</em>, <em>conditional_response=(No Default)</em>, <em>**kw</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a WSGI response</p>\n<dl class=\"attribute\">\n<dt id=\"webob.Response.accept_ranges\">\n<!--[webob.Response.accept_ranges]--><tt class=\"descname\">accept_ranges</tt><a class=\"headerlink\" href=\"#webob.Response.accept_ranges\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Accept-Ranges from the headers  For more information on Accept-Ranges see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.5\">section 14.5</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.age\">\n<!--[webob.Response.age]--><tt class=\"descname\">age</tt><a class=\"headerlink\" href=\"#webob.Response.age\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Age from the headers  For more information on Age see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.6\">section 14.6</a>.  Converts it as a int.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.allow\">\n<!--[webob.Response.allow]--><tt class=\"descname\">allow</tt><a class=\"headerlink\" href=\"#webob.Response.allow\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Allow from the headers  For more information on Allow see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.7\">section 14.7</a>.  Converts it as a list.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.app_iter\">\n<!--[webob.Response.app_iter]--><tt class=\"descname\">app_iter</tt><a class=\"headerlink\" href=\"#webob.Response.app_iter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Returns the app_iter of the response.</p>\n<p>If body was set, this will create an app_iter from that body\n(a single-item list)</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Response.app_iter_range\">\n<!--[webob.Response.app_iter_range]--><tt class=\"descname\">app_iter_range</tt><big>(</big><em>start</em>, <em>stop</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response.app_iter_range\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return a new app_iter built from the response app_iter, that\nserves up only the given <tt class=\"docutils literal\"><span class=\"pre\">start:stop</span></tt> range.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.body\">\n<!--[webob.Response.body]--><tt class=\"descname\">body</tt><a class=\"headerlink\" href=\"#webob.Response.body\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The body of the response, as a <tt class=\"docutils literal\"><span class=\"pre\">str</span></tt>.  This will read in the\nentire app_iter if necessary.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.body_file\">\n<!--[webob.Response.body_file]--><tt class=\"descname\">body_file</tt><a class=\"headerlink\" href=\"#webob.Response.body_file\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns a file-like object that can be used to write to the\nbody.  If you passed in a list app_iter, that app_iter will be\nmodified by writes.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.cache_control\">\n<!--[webob.Response.cache_control]--><tt class=\"descname\">cache_control</tt><a class=\"headerlink\" href=\"#webob.Response.cache_control\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Get/set/modify the Cache-Control header (section <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9\">14.9</a>)</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Response.cache_expires\">\n<!--[webob.Response.cache_expires]--><tt class=\"descname\">cache_expires</tt><big>(</big><em>seconds=0</em>, <em>**kw</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response.cache_expires\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Set expiration on this request.  This sets the response to\nexpire in the given seconds, and any other attributes are used\nfor cache_control (e.g., private=True, etc).</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.charset\">\n<!--[webob.Response.charset]--><tt class=\"descname\">charset</tt><a class=\"headerlink\" href=\"#webob.Response.charset\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Get/set the charset (in the Content-Type)</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Response.conditional_response_app\">\n<!--[webob.Response.conditional_response_app]--><tt class=\"descname\">conditional_response_app</tt><big>(</big><em>environ</em>, <em>start_response</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response.conditional_response_app\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Like the normal __call__ interface, but checks conditional headers:</p>\n<ul class=\"simple\">\n<li>If-Modified-Since   (304 Not Modified; only on GET, HEAD)</li>\n<li>If-None-Match       (304 Not Modified; only on GET, HEAD)</li>\n<li>Range               (406 Partial Content; only on GET, HEAD)</li>\n</ul>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.content_encoding\">\n<!--[webob.Response.content_encoding]--><tt class=\"descname\">content_encoding</tt><a class=\"headerlink\" href=\"#webob.Response.content_encoding\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Content-Encoding from the headers  For more information on Content-Encoding see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11\">section 14.11</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.content_language\">\n<!--[webob.Response.content_language]--><tt class=\"descname\">content_language</tt><a class=\"headerlink\" href=\"#webob.Response.content_language\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Content-Language from the headers  For more information on Content-Language see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12\">section 14.12</a>.  Converts it as a list.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.content_length\">\n<!--[webob.Response.content_length]--><tt class=\"descname\">content_length</tt><a class=\"headerlink\" href=\"#webob.Response.content_length\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Content-Length from the headers  For more information on Content-Length see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17\">section 14.17</a>.  Converts it as a int.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.content_location\">\n<!--[webob.Response.content_location]--><tt class=\"descname\">content_location</tt><a class=\"headerlink\" href=\"#webob.Response.content_location\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Content-Location from the headers  For more information on Content-Location see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14\">section 14.14</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.content_md5\">\n<!--[webob.Response.content_md5]--><tt class=\"descname\">content_md5</tt><a class=\"headerlink\" href=\"#webob.Response.content_md5\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Content-MD5 from the headers  For more information on Content-MD5 see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14\">section 14.14</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.content_range\">\n<!--[webob.Response.content_range]--><tt class=\"descname\">content_range</tt><a class=\"headerlink\" href=\"#webob.Response.content_range\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Content-Range from the headers  For more information on Content-Range see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16\">section 14.16</a>.  Converts it as a ContentRange object.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.content_type\">\n<!--[webob.Response.content_type]--><tt class=\"descname\">content_type</tt><a class=\"headerlink\" href=\"#webob.Response.content_type\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Get/set the Content-Type header (or None), <em>without</em> the\ncharset or any parameters.</p>\n<p>If you include parameters (or <tt class=\"docutils literal\"><span class=\"pre\">;</span></tt> at all) when setting the\ncontent_type, any existing parameters will be deleted;\notherwise they will be preserved.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.content_type_params\">\n<!--[webob.Response.content_type_params]--><tt class=\"descname\">content_type_params</tt><a class=\"headerlink\" href=\"#webob.Response.content_type_params\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns a dictionary of all the parameters in the content type.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.date\">\n<!--[webob.Response.date]--><tt class=\"descname\">date</tt><a class=\"headerlink\" href=\"#webob.Response.date\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Date from the headers  For more information on Date see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18\">section 14.18</a>.  Converts it as a HTTP date.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Response.delete_cookie\">\n<!--[webob.Response.delete_cookie]--><tt class=\"descname\">delete_cookie</tt><big>(</big><em>key</em>, <em>path='/'</em>, <em>domain=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response.delete_cookie\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Delete a cookie from the client.  Note that path and domain must match\nhow the cookie was originally set.</p>\n<p>This sets the cookie to the empty string, and max_age=0 so\nthat it should expire immediately.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Response.encode_content\">\n<!--[webob.Response.encode_content]--><tt class=\"descname\">encode_content</tt><big>(</big><em>encoding='gzip'</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response.encode_content\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Encode the content with the given encoding (only gzip and\nidentity are supported).</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.environ\">\n<!--[webob.Response.environ]--><tt class=\"descname\">environ</tt><a class=\"headerlink\" href=\"#webob.Response.environ\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Get/set the request environ associated with this response, if\nany.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.etag\">\n<!--[webob.Response.etag]--><tt class=\"descname\">etag</tt><a class=\"headerlink\" href=\"#webob.Response.etag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header ETag from the headers  For more information on ETag see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19\">section 14.19</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.expires\">\n<!--[webob.Response.expires]--><tt class=\"descname\">expires</tt><a class=\"headerlink\" href=\"#webob.Response.expires\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Expires from the headers  For more information on Expires see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21\">section 14.21</a>.  Converts it as a HTTP date.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.headerlist\">\n<!--[webob.Response.headerlist]--><tt class=\"descname\">headerlist</tt><a class=\"headerlink\" href=\"#webob.Response.headerlist\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The list of response headers</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.headers\">\n<!--[webob.Response.headers]--><tt class=\"descname\">headers</tt><a class=\"headerlink\" href=\"#webob.Response.headers\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The headers in a dictionary-like object</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.last_modified\">\n<!--[webob.Response.last_modified]--><tt class=\"descname\">last_modified</tt><a class=\"headerlink\" href=\"#webob.Response.last_modified\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Last-Modified from the headers  For more information on Last-Modified see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29\">section 14.29</a>.  Converts it as a HTTP date.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.location\">\n<!--[webob.Response.location]--><tt class=\"descname\">location</tt><a class=\"headerlink\" href=\"#webob.Response.location\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Retrieve the Location header of the response, or None if there\nis no header.  If the header is not absolute and this response\nis associated with a request, make the header absolute.</p>\n<p>For more information see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30\">section 14.30</a>.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Response.md5_etag\">\n<!--[webob.Response.md5_etag]--><tt class=\"descname\">md5_etag</tt><big>(</big><em>body=None</em>, <em>set_content_md5=False</em>, <em>set_conditional_response=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response.md5_etag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Generate an etag for the response object using an MD5 hash of\nthe body (the body parameter, or <tt class=\"docutils literal\"><span class=\"pre\">self.body</span></tt> if not given)</p>\n<p>Sets <tt class=\"docutils literal\"><span class=\"pre\">self.etag</span></tt>\nIf <tt class=\"docutils literal\"><span class=\"pre\">set_content_md5</span></tt> is True sets <tt class=\"docutils literal\"><span class=\"pre\">self.content_md5</span></tt> as well\nIf <tt class=\"docutils literal\"><span class=\"pre\">set_conditional_response</span></tt> is True sets <tt class=\"docutils literal\"><span class=\"pre\">self.conditional_response</span></tt> to True</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.pragma\">\n<!--[webob.Response.pragma]--><tt class=\"descname\">pragma</tt><a class=\"headerlink\" href=\"#webob.Response.pragma\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Pragma from the headers  For more information on Pragma see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32\">section 14.32</a>.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.request\">\n<!--[webob.Response.request]--><tt class=\"descname\">request</tt><a class=\"headerlink\" href=\"#webob.Response.request\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return the request associated with this response if any.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.retry_after\">\n<!--[webob.Response.retry_after]--><tt class=\"descname\">retry_after</tt><a class=\"headerlink\" href=\"#webob.Response.retry_after\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Retry-After from the headers  For more information on Retry-After see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37\">section 14.37</a>.  Converts it as a HTTP date or delta seconds.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.server\">\n<!--[webob.Response.server]--><tt class=\"descname\">server</tt><a class=\"headerlink\" href=\"#webob.Response.server\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Server from the headers  For more information on Server see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.38\">section 14.38</a>.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Response.set_cookie\">\n<!--[webob.Response.set_cookie]--><tt class=\"descname\">set_cookie</tt><big>(</big><em>key</em>, <em>value=''</em>, <em>max_age=None</em>, <em>path='/'</em>, <em>domain=None</em>, <em>secure=None</em>, <em>httponly=False</em>, <em>version=None</em>, <em>comment=None</em>, <em>expires=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response.set_cookie\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Set (add) a cookie for the response</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.status\">\n<!--[webob.Response.status]--><tt class=\"descname\">status</tt><a class=\"headerlink\" href=\"#webob.Response.status\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The status string</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.status_int\">\n<!--[webob.Response.status_int]--><tt class=\"descname\">status_int</tt><a class=\"headerlink\" href=\"#webob.Response.status_int\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The status as an integer</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.unicode_body\">\n<!--[webob.Response.unicode_body]--><tt class=\"descname\">unicode_body</tt><a class=\"headerlink\" href=\"#webob.Response.unicode_body\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Get/set the unicode value of the body (using the charset of the Content-Type)</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.Response.unset_cookie\">\n<!--[webob.Response.unset_cookie]--><tt class=\"descname\">unset_cookie</tt><big>(</big><em>key</em><big>)</big><a class=\"headerlink\" href=\"#webob.Response.unset_cookie\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Unset a cookie with the given name (remove it from the\nresponse).  If there are multiple cookies (e.g., two cookies\nwith the same name and different paths or domains), all such\ncookies will be deleted.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.Response.vary\">\n<!--[webob.Response.vary]--><tt class=\"descname\">vary</tt><a class=\"headerlink\" href=\"#webob.Response.vary\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Gets and sets and deletes they header Vary from the headers  For more information on Vary see <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44\">section 14.44</a>.  Converts it as a list.</dd></dl>\n\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webob.html_escape\">\n<!--[webob.html_escape]--><tt class=\"descclassname\">webob.</tt><tt class=\"descname\">html_escape</tt><big>(</big><em>s</em><big>)</big><a class=\"headerlink\" href=\"#webob.html_escape\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>HTML-escape a string or object</p>\n<p>This converts any non-string objects passed into it to strings\n(actually, using <tt class=\"docutils literal\"><span class=\"pre\">unicode()</span></tt>).  All values returned are\nnon-unicode strings (using <tt class=\"docutils literal\"><span class=\"pre\">&amp;#num;</span></tt> entities for all non-ASCII\ncharacters).</p>\n<p>None is treated specially, and returns the empty string.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webob.timedelta_to_seconds\">\n<!--[webob.timedelta_to_seconds]--><tt class=\"descclassname\">webob.</tt><tt class=\"descname\">timedelta_to_seconds</tt><big>(</big><em>td</em><big>)</big><a class=\"headerlink\" href=\"#webob.timedelta_to_seconds\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Converts a timedelta instance to seconds.</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.FakeCGIBody\">\n<!--[webob.FakeCGIBody]-->class <tt class=\"descclassname\">webob.</tt><tt class=\"descname\">FakeCGIBody</tt><big>(</big><em>vars</em><big>)</big><a class=\"headerlink\" href=\"#webob.FakeCGIBody\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><dl class=\"attribute\">\n<dt id=\"webob.FakeCGIBody.update_environ\">\n<!--[webob.FakeCGIBody.update_environ]--><tt class=\"descname\">update_environ</tt><a class=\"headerlink\" href=\"#webob.FakeCGIBody.update_environ\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.ResponseBodyFile\">\n<!--[webob.ResponseBodyFile]-->class <tt class=\"descclassname\">webob.</tt><tt class=\"descname\">ResponseBodyFile</tt><big>(</big><em>response</em><big>)</big><a class=\"headerlink\" href=\"#webob.ResponseBodyFile\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><dl class=\"attribute\">\n<dt id=\"webob.ResponseBodyFile.encoding\">\n<!--[webob.ResponseBodyFile.encoding]--><tt class=\"descname\">encoding</tt><a class=\"headerlink\" href=\"#webob.ResponseBodyFile.encoding\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>The encoding of the file (inherited from response.charset)</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.AppIterRange\">\n<!--[webob.AppIterRange]-->class <tt class=\"descclassname\">webob.</tt><tt class=\"descname\">AppIterRange</tt><big>(</big><em>app_iter</em>, <em>start</em>, <em>stop</em><big>)</big><a class=\"headerlink\" href=\"#webob.AppIterRange\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Wraps an app_iter, returning just a range of bytes</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webob._rfc_reference\">\n<!--[webob._rfc_reference]--><tt class=\"descclassname\">webob.</tt><tt class=\"descname\">_rfc_reference</tt><big>(</big><em>header</em>, <em>section</em><big>)</big><a class=\"headerlink\" href=\"#webob._rfc_reference\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webob._cgi_FieldStorage__repr__patch\">\n<!--[webob._cgi_FieldStorage__repr__patch]--><tt class=\"descclassname\">webob.</tt><tt class=\"descname\">_cgi_FieldStorage__repr__patch</tt><big>(</big><em>self</em><big>)</big><a class=\"headerlink\" href=\"#webob._cgi_FieldStorage__repr__patch\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>monkey patch for FieldStorage.__repr__</p>\n<p>Unbelievely, the default __repr__ on FieldStorage reads\nthe entire file content instead of being sane about it.\nThis is a simple replacement that doesn&#8217;t do that</p>\n</dd></dl>\n\n<div class=\"section\" id=\"webob-acceptparse\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.acceptparse</span></tt><a class=\"headerlink\" href=\"#webob-acceptparse\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"webob.acceptparse.Accept\">\n<!--[webob.acceptparse.Accept]-->class <tt class=\"descclassname\">webob.acceptparse.</tt><tt class=\"descname\">Accept</tt><big>(</big><em>header_name</em>, <em>header_value</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.Accept\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a generic <tt class=\"docutils literal\"><span class=\"pre\">Accept-*</span></tt> style header.</p>\n<p>This object should not be modified.  To add items you can use\n<tt class=\"docutils literal\"><span class=\"pre\">accept_obj</span> <span class=\"pre\">+</span> <span class=\"pre\">'accept_thing'</span></tt> to get a new object</p>\n<dl class=\"method\">\n<dt id=\"webob.acceptparse.Accept.best_match\">\n<!--[webob.acceptparse.Accept.best_match]--><tt class=\"descname\">best_match</tt><big>(</big><em>matches</em>, <em>default_match=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.Accept.best_match\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Returns the best match in the sequence of matches.</p>\n<p>The sequence can be a simple sequence, or you can have\n<tt class=\"docutils literal\"><span class=\"pre\">(match,</span> <span class=\"pre\">server_quality)</span></tt> items in the sequence.  If you\nhave these tuples then the client quality is multiplied by the\nserver_quality to get a total.</p>\n<p>default_match (default None) is returned if there is no intersection.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.acceptparse.Accept.best_matches\">\n<!--[webob.acceptparse.Accept.best_matches]--><tt class=\"descname\">best_matches</tt><big>(</big><em>fallback=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.Accept.best_matches\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return all the matches in order of quality, with fallback (if\ngiven) at the end.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.acceptparse.Accept.first_match\">\n<!--[webob.acceptparse.Accept.first_match]--><tt class=\"descname\">first_match</tt><big>(</big><em>matches</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.Accept.first_match\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns the first match in the sequences of matches that is\nallowed.  Ignores quality.  Returns the first item if nothing\nelse matches; or if you include None at the end of the match\nlist then that will be returned.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.acceptparse.Accept.quality\">\n<!--[webob.acceptparse.Accept.quality]--><tt class=\"descname\">quality</tt><big>(</big><em>match</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.Accept.quality\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return the quality of the given match.  Returns None if there\nis no match (not 0).</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.acceptparse.NilAccept\">\n<!--[webob.acceptparse.NilAccept]-->class <tt class=\"descclassname\">webob.acceptparse.</tt><tt class=\"descname\">NilAccept</tt><big>(</big><em>header_name</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.NilAccept\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents an Accept header with no value.</p>\n<dl class=\"method\">\n<dt id=\"webob.acceptparse.NilAccept.MasterClass\">\n<!--[webob.acceptparse.NilAccept.MasterClass]--><tt class=\"descname\">MasterClass</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.NilAccept.MasterClass\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a generic <tt class=\"docutils literal\"><span class=\"pre\">Accept-*</span></tt> style header.</p>\n<p>This object should not be modified.  To add items you can use\n<tt class=\"docutils literal\"><span class=\"pre\">accept_obj</span> <span class=\"pre\">+</span> <span class=\"pre\">'accept_thing'</span></tt> to get a new object</p>\n</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.acceptparse.NoAccept\">\n<!--[webob.acceptparse.NoAccept]-->class <tt class=\"descclassname\">webob.acceptparse.</tt><tt class=\"descname\">NoAccept</tt><big>(</big><em>header_name</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.NoAccept\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.acceptparse.MIMEAccept\">\n<!--[webob.acceptparse.MIMEAccept]-->class <tt class=\"descclassname\">webob.acceptparse.</tt><tt class=\"descname\">MIMEAccept</tt><big>(</big><em>header_name</em>, <em>header_value</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.MIMEAccept\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents the <tt class=\"docutils literal\"><span class=\"pre\">Accept</span></tt> header, which is a list of mimetypes.</p>\n<p>This class knows about mime wildcards, like <tt class=\"docutils literal\"><span class=\"pre\">image/*</span></tt></p>\n<dl class=\"method\">\n<dt id=\"webob.acceptparse.MIMEAccept.accept_html\">\n<!--[webob.acceptparse.MIMEAccept.accept_html]--><tt class=\"descname\">accept_html</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.MIMEAccept.accept_html\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns true if any HTML-like type is accepted</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.acceptparse.MIMENilAccept\">\n<!--[webob.acceptparse.MIMENilAccept]-->class <tt class=\"descclassname\">webob.acceptparse.</tt><tt class=\"descname\">MIMENilAccept</tt><big>(</big><em>header_name</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.MIMENilAccept\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><dl class=\"method\">\n<dt id=\"webob.acceptparse.MIMENilAccept.MasterClass\">\n<!--[webob.acceptparse.MIMENilAccept.MasterClass]--><tt class=\"descname\">MasterClass</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.MIMENilAccept.MasterClass\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents the <tt class=\"docutils literal\"><span class=\"pre\">Accept</span></tt> header, which is a list of mimetypes.</p>\n<p>This class knows about mime wildcards, like <tt class=\"docutils literal\"><span class=\"pre\">image/*</span></tt></p>\n</dd></dl>\n\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webob.acceptparse.parse_accept\">\n<!--[webob.acceptparse.parse_accept]--><tt class=\"descclassname\">webob.acceptparse.</tt><tt class=\"descname\">parse_accept</tt><big>(</big><em>value</em><big>)</big><a class=\"headerlink\" href=\"#webob.acceptparse.parse_accept\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Parses an <tt class=\"docutils literal\"><span class=\"pre\">Accept-*</span></tt> style header.</p>\n<p>A list of <tt class=\"docutils literal\"><span class=\"pre\">[(value,</span> <span class=\"pre\">quality),</span> <span class=\"pre\">...]</span></tt> is returned.  <tt class=\"docutils literal\"><span class=\"pre\">quality</span></tt>\nwill be 1 if it was not given.</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-webob.byterange\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.byterange</span></tt><a class=\"headerlink\" href=\"#module-webob.byterange\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"webob.byterange.Range\">\n<!--[webob.byterange.Range]-->class <tt class=\"descclassname\">webob.byterange.</tt><tt class=\"descname\">Range</tt><big>(</big><em>ranges</em><big>)</big><a class=\"headerlink\" href=\"#webob.byterange.Range\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents the Range header.</p>\n<p>This only represents <tt class=\"docutils literal\"><span class=\"pre\">bytes</span></tt> ranges, which are the only kind\nspecified in HTTP.  This can represent multiple sets of ranges,\nbut no place else is this multi-range facility supported.</p>\n<dl class=\"attribute\">\n<dt id=\"webob.byterange.Range.bytes_to_python_ranges\">\n<!--[webob.byterange.Range.bytes_to_python_ranges]--><tt class=\"descname\">bytes_to_python_ranges</tt><a class=\"headerlink\" href=\"#webob.byterange.Range.bytes_to_python_ranges\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Converts the list-of-ranges from parse_bytes() to a Python-style\nlist of ranges (non-inclusive end points)</p>\n<p>In the list of ranges, the last item can be None to indicate that\nit should go to the end of the file, and the first item can be\nnegative to indicate that it should start from an offset from the\nend.  If you give a length then this will not occur (negative\nnumbers and offsets will be resolved).</p>\n<p>If length is given, and any range is not value, then None is\nreturned.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.byterange.Range.content_range\">\n<!--[webob.byterange.Range.content_range]--><tt class=\"descname\">content_range</tt><big>(</big><em>length</em><big>)</big><a class=\"headerlink\" href=\"#webob.byterange.Range.content_range\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Works like range_for_length; returns None or a ContentRange object</p>\n<p>You can use it like:</p>\n<div class=\"highlight\"><pre><span class=\"n\">response</span><span class=\"o\">.</span><span class=\"n\">content_range</span> <span class=\"o\">=</span> <span class=\"n\">req</span><span class=\"o\">.</span><span class=\"n\">range</span><span class=\"o\">.</span><span class=\"n\">content_range</span><span class=\"p\">(</span><span class=\"n\">response</span><span class=\"o\">.</span><span class=\"n\">content_length</span><span class=\"p\">)</span>\n</pre></div>\n<p>Though it&#8217;s still up to you to actually serve that content range!</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.byterange.Range.parse\">\n<!--[webob.byterange.Range.parse]--><tt class=\"descname\">parse</tt><a class=\"headerlink\" href=\"#webob.byterange.Range.parse\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Parse the header; may return None if header is invalid</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.byterange.Range.parse_bytes\">\n<!--[webob.byterange.Range.parse_bytes]--><tt class=\"descname\">parse_bytes</tt><a class=\"headerlink\" href=\"#webob.byterange.Range.parse_bytes\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Parse a Range header into (bytes, list_of_ranges).  Note that the\nranges are <em>inclusive</em> (like in HTTP, not like in Python\ntypically).</p>\n<p>Will return None if the header is invalid</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.byterange.Range.python_ranges_to_bytes\">\n<!--[webob.byterange.Range.python_ranges_to_bytes]--><tt class=\"descname\">python_ranges_to_bytes</tt><a class=\"headerlink\" href=\"#webob.byterange.Range.python_ranges_to_bytes\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Converts a Python-style list of ranges to what serialize_bytes\nexpects.</p>\n<p>This is the inverse of bytes_to_python_ranges</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.byterange.Range.range_for_length\">\n<!--[webob.byterange.Range.range_for_length]--><tt class=\"descname\">range_for_length</tt><big>(</big><em>length</em><big>)</big><a class=\"headerlink\" href=\"#webob.byterange.Range.range_for_length\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p><em>If</em> there is only one range, and <em>if</em> it is satisfiable by\nthe given length, then return a (begin, end) non-inclusive range\nof bytes to serve.  Otherwise return None</p>\n<p>If length is None (unknown length), then the resulting range\nmay be (begin, None), meaning it should be served from that\npoint.  If it&#8217;s a range with a fixed endpoint we won&#8217;t know if\nit is satisfiable, so this will return None.</p>\n</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.byterange.Range.satisfiable\">\n<!--[webob.byterange.Range.satisfiable]--><tt class=\"descname\">satisfiable</tt><big>(</big><em>length</em><big>)</big><a class=\"headerlink\" href=\"#webob.byterange.Range.satisfiable\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns true if this range can be satisfied by the resource\nwith the given byte length.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.byterange.Range.serialize_bytes\">\n<!--[webob.byterange.Range.serialize_bytes]--><tt class=\"descname\">serialize_bytes</tt><a class=\"headerlink\" href=\"#webob.byterange.Range.serialize_bytes\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Takes the output of parse_bytes and turns it into a header</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.byterange.ContentRange\">\n<!--[webob.byterange.ContentRange]-->class <tt class=\"descclassname\">webob.byterange.</tt><tt class=\"descname\">ContentRange</tt><big>(</big><em>start</em>, <em>stop</em>, <em>length</em><big>)</big><a class=\"headerlink\" href=\"#webob.byterange.ContentRange\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents the Content-Range header</p>\n<p>This header is <tt class=\"docutils literal\"><span class=\"pre\">start-stop/length</span></tt>, where stop and length can be\n<tt class=\"docutils literal\"><span class=\"pre\">*</span></tt> (represented as None in the attributes).</p>\n<dl class=\"attribute\">\n<dt id=\"webob.byterange.ContentRange.parse\">\n<!--[webob.byterange.ContentRange.parse]--><tt class=\"descname\">parse</tt><a class=\"headerlink\" href=\"#webob.byterange.ContentRange.parse\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Parse the header.  May return None if it cannot parse.</dd></dl>\n\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-webob.cachecontrol\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.cachecontrol</span></tt><a class=\"headerlink\" href=\"#module-webob.cachecontrol\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Represents the Cache-Control header</p>\n<dl class=\"class\">\n<dt id=\"webob.cachecontrol.exists_property\">\n<!--[webob.cachecontrol.exists_property]-->class <tt class=\"descclassname\">webob.cachecontrol.</tt><tt class=\"descname\">exists_property</tt><big>(</big><em>prop</em>, <em>type=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.cachecontrol.exists_property\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a property that either is listed in the Cache-Control\nheader, or is not listed (has no value)</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.cachecontrol.value_property\">\n<!--[webob.cachecontrol.value_property]-->class <tt class=\"descclassname\">webob.cachecontrol.</tt><tt class=\"descname\">value_property</tt><big>(</big><em>prop</em>, <em>default=None</em>, <em>none=None</em>, <em>type=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.cachecontrol.value_property\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a property that has a value in the Cache-Control header.</p>\n<p>When no value is actually given, the value of self.none is returned.</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.cachecontrol.CacheControl\">\n<!--[webob.cachecontrol.CacheControl]-->class <tt class=\"descclassname\">webob.cachecontrol.</tt><tt class=\"descname\">CacheControl</tt><big>(</big><em>properties</em>, <em>type</em><big>)</big><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents the Cache-Control header.</p>\n<p>By giving a type of <tt class=\"docutils literal\"><span class=\"pre\">'request'</span></tt> or <tt class=\"docutils literal\"><span class=\"pre\">'response'</span></tt> you can\ncontrol what attributes are allowed (some Cache-Control values\nonly apply to requests or responses).</p>\n<dl class=\"method\">\n<dt id=\"webob.cachecontrol.CacheControl.copy\">\n<!--[webob.cachecontrol.CacheControl.copy]--><tt class=\"descname\">copy</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.copy\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns a copy of this object.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.max_age\">\n<!--[webob.cachecontrol.CacheControl.max_age]--><tt class=\"descname\">max_age</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.max_age\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a property that has a value in the Cache-Control header.</p>\n<p>When no value is actually given, the value of self.none is returned.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.max_stale\">\n<!--[webob.cachecontrol.CacheControl.max_stale]--><tt class=\"descname\">max_stale</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.max_stale\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a property that has a value in the Cache-Control header.</p>\n<p>When no value is actually given, the value of self.none is returned.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.min_fresh\">\n<!--[webob.cachecontrol.CacheControl.min_fresh]--><tt class=\"descname\">min_fresh</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.min_fresh\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a property that has a value in the Cache-Control header.</p>\n<p>When no value is actually given, the value of self.none is returned.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.must_revalidate\">\n<!--[webob.cachecontrol.CacheControl.must_revalidate]--><tt class=\"descname\">must_revalidate</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.must_revalidate\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a property that either is listed in the Cache-Control\nheader, or is not listed (has no value)</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.no_cache\">\n<!--[webob.cachecontrol.CacheControl.no_cache]--><tt class=\"descname\">no_cache</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.no_cache\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a property that has a value in the Cache-Control header.</p>\n<p>When no value is actually given, the value of self.none is returned.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.no_store\">\n<!--[webob.cachecontrol.CacheControl.no_store]--><tt class=\"descname\">no_store</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.no_store\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a property that either is listed in the Cache-Control\nheader, or is not listed (has no value)</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.no_transform\">\n<!--[webob.cachecontrol.CacheControl.no_transform]--><tt class=\"descname\">no_transform</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.no_transform\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a property that either is listed in the Cache-Control\nheader, or is not listed (has no value)</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.only_if_cached\">\n<!--[webob.cachecontrol.CacheControl.only_if_cached]--><tt class=\"descname\">only_if_cached</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.only_if_cached\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a property that either is listed in the Cache-Control\nheader, or is not listed (has no value)</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.parse\">\n<!--[webob.cachecontrol.CacheControl.parse]--><tt class=\"descname\">parse</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.parse\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Parse the header, returning a CacheControl object.</p>\n<p>The object is bound to the request or response object\n<tt class=\"docutils literal\"><span class=\"pre\">updates_to</span></tt>, if that is given.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.private\">\n<!--[webob.cachecontrol.CacheControl.private]--><tt class=\"descname\">private</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.private\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a property that has a value in the Cache-Control header.</p>\n<p>When no value is actually given, the value of self.none is returned.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.proxy_revalidate\">\n<!--[webob.cachecontrol.CacheControl.proxy_revalidate]--><tt class=\"descname\">proxy_revalidate</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.proxy_revalidate\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a property that either is listed in the Cache-Control\nheader, or is not listed (has no value)</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.public\">\n<!--[webob.cachecontrol.CacheControl.public]--><tt class=\"descname\">public</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.public\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a property that either is listed in the Cache-Control\nheader, or is not listed (has no value)</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.s_max_age\">\n<!--[webob.cachecontrol.CacheControl.s_max_age]--><tt class=\"descname\">s_max_age</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.s_max_age\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a property that has a value in the Cache-Control header.</p>\n<p>When no value is actually given, the value of self.none is returned.</p>\n</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.cachecontrol.CacheControl.s_maxage\">\n<!--[webob.cachecontrol.CacheControl.s_maxage]--><tt class=\"descname\">s_maxage</tt><a class=\"headerlink\" href=\"#webob.cachecontrol.CacheControl.s_maxage\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents a property that has a value in the Cache-Control header.</p>\n<p>When no value is actually given, the value of self.none is returned.</p>\n</dd></dl>\n\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webob.cachecontrol.serialize_cache_control\">\n<!--[webob.cachecontrol.serialize_cache_control]--><tt class=\"descclassname\">webob.cachecontrol.</tt><tt class=\"descname\">serialize_cache_control</tt><big>(</big><em>properties</em><big>)</big><a class=\"headerlink\" href=\"#webob.cachecontrol.serialize_cache_control\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-webob.datastruct\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.datastruct</span></tt><a class=\"headerlink\" href=\"#module-webob.datastruct\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Contains some data structures.</p>\n<dl class=\"class\">\n<dt id=\"webob.datastruct.EnvironHeaders\">\n<!--[webob.datastruct.EnvironHeaders]-->class <tt class=\"descclassname\">webob.datastruct.</tt><tt class=\"descname\">EnvironHeaders</tt><big>(</big><em>environ</em><big>)</big><a class=\"headerlink\" href=\"#webob.datastruct.EnvironHeaders\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>An object that represents the headers as present in a\nWSGI environment.</p>\n<p>This object is a wrapper (with no internal state) for a WSGI\nrequest object, representing the CGI-style HTTP_* keys as a\ndictionary.  Because a CGI environment can only hold one value for\neach key, this dictionary is single-valued (unlike outgoing\nheaders).</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-webob.etag\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.etag</span></tt><a class=\"headerlink\" href=\"#module-webob.etag\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Does parsing of ETag-related headers: If-None-Matches, If-Matches</p>\n<p>Also If-Range parsing</p>\n<dl class=\"class\">\n<dt id=\"webob.etag.AnyETag\">\n<!--[webob.etag.AnyETag]-->class <tt class=\"descclassname\">webob.etag.</tt><tt class=\"descname\">AnyETag</tt><a class=\"headerlink\" href=\"#webob.etag.AnyETag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents an ETag of <tt class=\"docutils literal\"><span class=\"pre\">*</span></tt>, or a missing ETag when matching is &#8216;safe&#8217;</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.etag.NoETag\">\n<!--[webob.etag.NoETag]-->class <tt class=\"descclassname\">webob.etag.</tt><tt class=\"descname\">NoETag</tt><a class=\"headerlink\" href=\"#webob.etag.NoETag\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a missing ETag when matching is unsafe</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.etag.ETagMatcher\">\n<!--[webob.etag.ETagMatcher]-->class <tt class=\"descclassname\">webob.etag.</tt><tt class=\"descname\">ETagMatcher</tt><big>(</big><em>etags</em>, <em>weak_etags=()</em><big>)</big><a class=\"headerlink\" href=\"#webob.etag.ETagMatcher\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents an ETag request.  Supports containment to see if an\nETag matches.  You can also use\n<tt class=\"docutils literal\"><span class=\"pre\">etag_matcher.weak_contains(etag)</span></tt> to allow weak ETags to match\n(allowable for conditional GET requests, but not ranges or other\nmethods).</p>\n<dl class=\"attribute\">\n<dt id=\"webob.etag.ETagMatcher.parse\">\n<!--[webob.etag.ETagMatcher.parse]--><tt class=\"descname\">parse</tt><a class=\"headerlink\" href=\"#webob.etag.ETagMatcher.parse\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Parse this from a header value</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.etag.IfRange\">\n<!--[webob.etag.IfRange]-->class <tt class=\"descclassname\">webob.etag.</tt><tt class=\"descname\">IfRange</tt><big>(</big><em>etag=None</em>, <em>date=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.etag.IfRange\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Parses and represents the If-Range header, which can be\nan ETag <em>or</em> a date</p>\n<dl class=\"method\">\n<dt id=\"webob.etag.IfRange.match\">\n<!--[webob.etag.IfRange.match]--><tt class=\"descname\">match</tt><big>(</big><em>etag=None</em>, <em>last_modified=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.etag.IfRange.match\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return True if the If-Range header matches the given etag or last_modified</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.etag.IfRange.match_response\">\n<!--[webob.etag.IfRange.match_response]--><tt class=\"descname\">match_response</tt><big>(</big><em>response</em><big>)</big><a class=\"headerlink\" href=\"#webob.etag.IfRange.match_response\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return True if this matches the given <tt class=\"docutils literal\"><span class=\"pre\">webob.Response</span></tt> instance.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.etag.IfRange.parse\">\n<!--[webob.etag.IfRange.parse]--><tt class=\"descname\">parse</tt><a class=\"headerlink\" href=\"#webob.etag.IfRange.parse\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Parse this from a header value.</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.etag.NoIfRange\">\n<!--[webob.etag.NoIfRange]-->class <tt class=\"descclassname\">webob.etag.</tt><tt class=\"descname\">NoIfRange</tt><a class=\"headerlink\" href=\"#webob.etag.NoIfRange\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Represents a missing If-Range header</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-webob.exc\">\n<h2>mod:<cite>webob.exc</cite><a class=\"headerlink\" href=\"#module-webob.exc\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>HTTP Exception</p>\n<p>This module processes Python exceptions that relate to HTTP exceptions\nby defining a set of exceptions, all subclasses of HTTPException.\nEach exception, in addition to being a Python exception that can be\nraised and caught, is also a WSGI application and <tt class=\"docutils literal\"><span class=\"pre\">webob.Response</span></tt>\nobject.</p>\n<p>This module defines exceptions according to RFC 2068 <a class=\"footnote-reference\" href=\"#id9\" id=\"id7\">[1]</a> : codes with\n100-300 are not really errors; 400&#8217;s are client errors, and 500&#8217;s are\nserver errors.  According to the WSGI specification <a class=\"footnote-reference\" href=\"#id10\" id=\"id8\">[2]</a> , the application\ncan call <tt class=\"docutils literal\"><span class=\"pre\">start_response</span></tt> more then once only under two conditions:\n(a) the response has not yet been sent, or (b) if the second and\nsubsequent invocations of <tt class=\"docutils literal\"><span class=\"pre\">start_response</span></tt> have a valid <tt class=\"docutils literal\"><span class=\"pre\">exc_info</span></tt>\nargument obtained from <tt class=\"docutils literal\"><span class=\"pre\">sys.exc_info()</span></tt>.  The WSGI specification then\nrequires the server or gateway to handle the case where content has been\nsent and then an exception was encountered.</p>\n<dl class=\"docutils\">\n<dt>Exception</dt>\n<dd><dl class=\"first last docutils\">\n<dt>HTTPException</dt>\n<dd><dl class=\"first last docutils\">\n<dt>HTTPOk</dt>\n<dd><ul class=\"first last simple\">\n<li>200 - HTTPOk</li>\n<li>201 - HTTPCreated</li>\n<li>202 - HTTPAccepted</li>\n<li>203 - HTTPNonAuthoritativeInformation</li>\n<li>204 - HTTPNoContent</li>\n<li>205 - HTTPResetContent</li>\n<li>206 - HTTPPartialContent</li>\n</ul>\n</dd>\n<dt>HTTPRedirection</dt>\n<dd><ul class=\"first last simple\">\n<li>300 - HTTPMultipleChoices</li>\n<li>301 - HTTPMovedPermanently</li>\n<li>302 - HTTPFound</li>\n<li>303 - HTTPSeeOther</li>\n<li>304 - HTTPNotModified</li>\n<li>305 - HTTPUseProxy</li>\n<li>306 - Unused (not implemented, obviously)</li>\n<li>307 - HTTPTemporaryRedirect</li>\n</ul>\n</dd>\n<dt>HTTPError</dt>\n<dd><dl class=\"first last docutils\">\n<dt>HTTPClientError</dt>\n<dd><ul class=\"first last simple\">\n<li>400 - HTTPBadRequest</li>\n<li>401 - HTTPUnauthorized</li>\n<li>402 - HTTPPaymentRequired</li>\n<li>403 - HTTPForbidden</li>\n<li>404 - HTTPNotFound</li>\n<li>405 - HTTPMethodNotAllowed</li>\n<li>406 - HTTPNotAcceptable</li>\n<li>407 - HTTPProxyAuthenticationRequired</li>\n<li>408 - HTTPRequestTimeout</li>\n<li>409 - HTTPConfict</li>\n<li>410 - HTTPGone</li>\n<li>411 - HTTPLengthRequired</li>\n<li>412 - HTTPPreconditionFailed</li>\n<li>413 - HTTPRequestEntityTooLarge</li>\n<li>414 - HTTPRequestURITooLong</li>\n<li>415 - HTTPUnsupportedMediaType</li>\n<li>416 - HTTPRequestRangeNotSatisfiable</li>\n<li>417 - HTTPExpectationFailed</li>\n</ul>\n</dd>\n<dt>HTTPServerError</dt>\n<dd><ul class=\"first last simple\">\n<li>500 - HTTPInternalServerError</li>\n<li>501 - HTTPNotImplemented</li>\n<li>502 - HTTPBadGateway</li>\n<li>503 - HTTPServiceUnavailable</li>\n<li>504 - HTTPGatewayTimeout</li>\n<li>505 - HTTPVersionNotSupported</li>\n</ul>\n</dd>\n</dl>\n</dd>\n</dl>\n</dd>\n</dl>\n</dd>\n</dl>\n<p>References:</p>\n<table class=\"docutils footnote\" frame=\"void\" id=\"id9\" rules=\"none\">\n<colgroup><col class=\"label\" /><col /></colgroup>\n<tbody valign=\"top\">\n<tr><td class=\"label\"><a class=\"fn-backref\" href=\"#id7\">[1]</a></td><td><a class=\"reference external\" href=\"http://www.python.org/peps/pep-0333.html#error-handling\">http://www.python.org/peps/pep-0333.html#error-handling</a></td></tr>\n</tbody>\n</table>\n<table class=\"docutils footnote\" frame=\"void\" id=\"id10\" rules=\"none\">\n<colgroup><col class=\"label\" /><col /></colgroup>\n<tbody valign=\"top\">\n<tr><td class=\"label\"><a class=\"fn-backref\" href=\"#id8\">[2]</a></td><td><a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5\">http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5</a></td></tr>\n</tbody>\n</table>\n<dl class=\"function\">\n<dt id=\"webob.exc.no_escape\">\n<!--[webob.exc.no_escape]--><tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">no_escape</tt><big>(</big><em>value</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.no_escape\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webob.exc.strip_tags\">\n<!--[webob.exc.strip_tags]--><tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">strip_tags</tt><big>(</big><em>value</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.strip_tags\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPException\">\n<!--[webob.exc.HTTPException]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPException</tt><big>(</big><em>message</em>, <em>wsgi_response</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPException\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Exception used on pre-Python-2.5, where new-style classes cannot be used as\nan exception.</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.WSGIHTTPException\">\n<!--[webob.exc.WSGIHTTPException]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">WSGIHTTPException</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.WSGIHTTPException\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPError\">\n<!--[webob.exc.HTTPError]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPError</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPError\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>base class for status codes in the 400&#8217;s and 500&#8217;s</p>\n<p>This is an exception which indicates that an error has occurred,\nand that any work in progress should not be committed.  These are\ntypically results in the 400&#8217;s and 500&#8217;s.</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPRedirection\">\n<!--[webob.exc.HTTPRedirection]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPRedirection</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPRedirection\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>base class for 300&#8217;s status code (redirections)</p>\n<p>This is an abstract base class for 3xx redirection.  It indicates\nthat further action needs to be taken by the user agent in order\nto fulfill the request.  It does not necessarly signal an error\ncondition.</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPOk\">\n<!--[webob.exc.HTTPOk]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPOk</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPOk\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Base class for the 200&#8217;s status code (successful responses)</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPCreated\">\n<!--[webob.exc.HTTPCreated]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPCreated</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPCreated\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPAccepted\">\n<!--[webob.exc.HTTPAccepted]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPAccepted</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPAccepted\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPNonAuthoritativeInformation\">\n<!--[webob.exc.HTTPNonAuthoritativeInformation]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPNonAuthoritativeInformation</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPNonAuthoritativeInformation\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPNoContent\">\n<!--[webob.exc.HTTPNoContent]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPNoContent</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPNoContent\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPResetContent\">\n<!--[webob.exc.HTTPResetContent]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPResetContent</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPResetContent\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPPartialContent\">\n<!--[webob.exc.HTTPPartialContent]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPPartialContent</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPPartialContent\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPMultipleChoices\">\n<!--[webob.exc.HTTPMultipleChoices]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPMultipleChoices</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em>, <em>location=None</em>, <em>add_slash=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPMultipleChoices\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPMovedPermanently\">\n<!--[webob.exc.HTTPMovedPermanently]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPMovedPermanently</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em>, <em>location=None</em>, <em>add_slash=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPMovedPermanently\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPFound\">\n<!--[webob.exc.HTTPFound]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPFound</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em>, <em>location=None</em>, <em>add_slash=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPFound\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPSeeOther\">\n<!--[webob.exc.HTTPSeeOther]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPSeeOther</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em>, <em>location=None</em>, <em>add_slash=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPSeeOther\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPNotModified\">\n<!--[webob.exc.HTTPNotModified]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPNotModified</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPNotModified\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPUseProxy\">\n<!--[webob.exc.HTTPUseProxy]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPUseProxy</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em>, <em>location=None</em>, <em>add_slash=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPUseProxy\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPTemporaryRedirect\">\n<!--[webob.exc.HTTPTemporaryRedirect]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPTemporaryRedirect</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em>, <em>location=None</em>, <em>add_slash=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPTemporaryRedirect\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPClientError\">\n<!--[webob.exc.HTTPClientError]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPClientError</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPClientError\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>base class for the 400&#8217;s, where the client is in error</p>\n<p>This is an error condition in which the client is presumed to be\nin-error.  This is an expected problem, and thus is not considered\na bug.  A server-side traceback is not warranted.  Unless specialized,\nthis is a &#8216;400 Bad Request&#8217;</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPBadRequest\">\n<!--[webob.exc.HTTPBadRequest]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPBadRequest</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPBadRequest\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPUnauthorized\">\n<!--[webob.exc.HTTPUnauthorized]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPUnauthorized</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPUnauthorized\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPPaymentRequired\">\n<!--[webob.exc.HTTPPaymentRequired]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPPaymentRequired</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPPaymentRequired\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPForbidden\">\n<!--[webob.exc.HTTPForbidden]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPForbidden</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPForbidden\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPNotFound\">\n<!--[webob.exc.HTTPNotFound]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPNotFound</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPNotFound\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPMethodNotAllowed\">\n<!--[webob.exc.HTTPMethodNotAllowed]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPMethodNotAllowed</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPMethodNotAllowed\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPNotAcceptable\">\n<!--[webob.exc.HTTPNotAcceptable]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPNotAcceptable</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPNotAcceptable\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPProxyAuthenticationRequired\">\n<!--[webob.exc.HTTPProxyAuthenticationRequired]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPProxyAuthenticationRequired</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPProxyAuthenticationRequired\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPRequestTimeout\">\n<!--[webob.exc.HTTPRequestTimeout]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPRequestTimeout</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPRequestTimeout\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPConflict\">\n<!--[webob.exc.HTTPConflict]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPConflict</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPConflict\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPGone\">\n<!--[webob.exc.HTTPGone]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPGone</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPGone\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPLengthRequired\">\n<!--[webob.exc.HTTPLengthRequired]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPLengthRequired</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPLengthRequired\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPPreconditionFailed\">\n<!--[webob.exc.HTTPPreconditionFailed]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPPreconditionFailed</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPPreconditionFailed\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPRequestEntityTooLarge\">\n<!--[webob.exc.HTTPRequestEntityTooLarge]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPRequestEntityTooLarge</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPRequestEntityTooLarge\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPRequestURITooLong\">\n<!--[webob.exc.HTTPRequestURITooLong]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPRequestURITooLong</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPRequestURITooLong\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPUnsupportedMediaType\">\n<!--[webob.exc.HTTPUnsupportedMediaType]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPUnsupportedMediaType</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPUnsupportedMediaType\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPRequestRangeNotSatisfiable\">\n<!--[webob.exc.HTTPRequestRangeNotSatisfiable]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPRequestRangeNotSatisfiable</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPRequestRangeNotSatisfiable\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPExpectationFailed\">\n<!--[webob.exc.HTTPExpectationFailed]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPExpectationFailed</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPExpectationFailed\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPUnprocessableEntity\">\n<!--[webob.exc.HTTPUnprocessableEntity]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPUnprocessableEntity</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPUnprocessableEntity\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPLocked\">\n<!--[webob.exc.HTTPLocked]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPLocked</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPLocked\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPFailedDependency\">\n<!--[webob.exc.HTTPFailedDependency]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPFailedDependency</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPFailedDependency\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPServerError\">\n<!--[webob.exc.HTTPServerError]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPServerError</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPServerError\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>base class for the 500&#8217;s, where the server is in-error</p>\n<p>This is an error condition in which the server is presumed to be\nin-error.  This is usually unexpected, and thus requires a traceback;\nideally, opening a support ticket for the customer. Unless specialized,\nthis is a &#8216;500 Internal Server Error&#8217;</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPInternalServerError\">\n<!--[webob.exc.HTTPInternalServerError]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPInternalServerError</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPInternalServerError\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPNotImplemented\">\n<!--[webob.exc.HTTPNotImplemented]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPNotImplemented</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPNotImplemented\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPBadGateway\">\n<!--[webob.exc.HTTPBadGateway]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPBadGateway</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPBadGateway\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPServiceUnavailable\">\n<!--[webob.exc.HTTPServiceUnavailable]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPServiceUnavailable</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPServiceUnavailable\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPGatewayTimeout\">\n<!--[webob.exc.HTTPGatewayTimeout]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPGatewayTimeout</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPGatewayTimeout\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPVersionNotSupported\">\n<!--[webob.exc.HTTPVersionNotSupported]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPVersionNotSupported</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPVersionNotSupported\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPInsufficientStorage\">\n<!--[webob.exc.HTTPInsufficientStorage]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPInsufficientStorage</tt><big>(</big><em>detail=None</em>, <em>headers=None</em>, <em>comment=None</em>, <em>body_template=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPInsufficientStorage\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.exc.HTTPExceptionMiddleware\">\n<!--[webob.exc.HTTPExceptionMiddleware]-->class <tt class=\"descclassname\">webob.exc.</tt><tt class=\"descname\">HTTPExceptionMiddleware</tt><big>(</big><em>application</em><big>)</big><a class=\"headerlink\" href=\"#webob.exc.HTTPExceptionMiddleware\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Middleware that catches exceptions in the sub-application.  This\ndoes not catch exceptions in the app_iter; only during the initial\ncalling of the application.</p>\n<p>This should be put <em>very close</em> to applications that might raise\nthese exceptions.  This should not be applied globally; letting\n<em>expected</em> exceptions raise through the WSGI stack is dangerous.</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-webob.headerdict\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.headerdict</span></tt><a class=\"headerlink\" href=\"#module-webob.headerdict\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Represents the response header list as a dictionary-like object.</p>\n<dl class=\"class\">\n<dt id=\"webob.headerdict.HeaderDict\">\n<!--[webob.headerdict.HeaderDict]-->class <tt class=\"descclassname\">webob.headerdict.</tt><tt class=\"descname\">HeaderDict</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class=\"headerlink\" href=\"#webob.headerdict.HeaderDict\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Like a MultiDict, this wraps a list.  Keys are normalized\nfor case and whitespace.</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-webob.multidict\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.multidict</span></tt><a class=\"headerlink\" href=\"#module-webob.multidict\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Gives a multi-value dictionary object (MultiDict) plus several wrappers</p>\n<dl class=\"class\">\n<dt id=\"webob.multidict.MultiDict\">\n<!--[webob.multidict.MultiDict]-->class <tt class=\"descclassname\">webob.multidict.</tt><tt class=\"descname\">MultiDict</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.MultiDict\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>An ordered dictionary that can have multiple values for each key.\nAdds the methods getall, getone, mixed, and add to the normal\ndictionary interface.</p>\n<dl class=\"method\">\n<dt id=\"webob.multidict.MultiDict.add\">\n<!--[webob.multidict.MultiDict.add]--><tt class=\"descname\">add</tt><big>(</big><em>key</em>, <em>value</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.MultiDict.add\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Add the key and value, not overwriting any previous value.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.multidict.MultiDict.dict_of_lists\">\n<!--[webob.multidict.MultiDict.dict_of_lists]--><tt class=\"descname\">dict_of_lists</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.MultiDict.dict_of_lists\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns a dictionary where each key is associated with a\nlist of values.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.multidict.MultiDict.from_fieldstorage\">\n<!--[webob.multidict.MultiDict.from_fieldstorage]--><tt class=\"descname\">from_fieldstorage</tt><a class=\"headerlink\" href=\"#webob.multidict.MultiDict.from_fieldstorage\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Create a dict from a cgi.FieldStorage instance</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.multidict.MultiDict.getall\">\n<!--[webob.multidict.MultiDict.getall]--><tt class=\"descname\">getall</tt><big>(</big><em>key</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.MultiDict.getall\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return a list of all values matching the key (may be an empty list)</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.multidict.MultiDict.getone\">\n<!--[webob.multidict.MultiDict.getone]--><tt class=\"descname\">getone</tt><big>(</big><em>key</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.MultiDict.getone\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Get one value matching the key, raising a KeyError if multiple\nvalues were found.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.multidict.MultiDict.mixed\">\n<!--[webob.multidict.MultiDict.mixed]--><tt class=\"descname\">mixed</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.MultiDict.mixed\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns a dictionary where the values are either single\nvalues, or a list of values when a key/value appears more than\nonce in this dictionary.  This is similar to the kind of\ndictionary often used to represent the variables in a web\nrequest.</dd></dl>\n\n<dl class=\"attribute\">\n<dt id=\"webob.multidict.MultiDict.view_list\">\n<!--[webob.multidict.MultiDict.view_list]--><tt class=\"descname\">view_list</tt><a class=\"headerlink\" href=\"#webob.multidict.MultiDict.view_list\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Create a dict that is a view on the given list</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.multidict.UnicodeMultiDict\">\n<!--[webob.multidict.UnicodeMultiDict]-->class <tt class=\"descclassname\">webob.multidict.</tt><tt class=\"descname\">UnicodeMultiDict</tt><big>(</big><em>multi=None</em>, <em>encoding=None</em>, <em>errors='strict'</em>, <em>decode_keys=False</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.UnicodeMultiDict\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>A MultiDict wrapper that decodes returned values to unicode on the\nfly. Decoding is not applied to assigned values.</p>\n<p>The key/value contents are assumed to be <tt class=\"docutils literal\"><span class=\"pre\">str</span></tt>/<tt class=\"docutils literal\"><span class=\"pre\">strs</span></tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">str</span></tt>/<tt class=\"docutils literal\"><span class=\"pre\">FieldStorages</span></tt> (as is returned by the <tt class=\"docutils literal\"><span class=\"pre\">paste.request.parse_</span></tt>\nfunctions).</p>\n<p>Can optionally also decode keys when the <tt class=\"docutils literal\"><span class=\"pre\">decode_keys</span></tt> argument is\nTrue.</p>\n<p><tt class=\"docutils literal\"><span class=\"pre\">FieldStorage</span></tt> instances are cloned, and the clone&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">filename</span></tt>\nvariable is decoded. Its <tt class=\"docutils literal\"><span class=\"pre\">name</span></tt> variable is decoded when <tt class=\"docutils literal\"><span class=\"pre\">decode_keys</span></tt>\nis enabled.</p>\n<dl class=\"method\">\n<dt id=\"webob.multidict.UnicodeMultiDict.add\">\n<!--[webob.multidict.UnicodeMultiDict.add]--><tt class=\"descname\">add</tt><big>(</big><em>key</em>, <em>value</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.UnicodeMultiDict.add\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Add the key and value, not overwriting any previous value.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.multidict.UnicodeMultiDict.dict_of_lists\">\n<!--[webob.multidict.UnicodeMultiDict.dict_of_lists]--><tt class=\"descname\">dict_of_lists</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.UnicodeMultiDict.dict_of_lists\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns a dictionary where each key is associated with a\nlist of values.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.multidict.UnicodeMultiDict.getall\">\n<!--[webob.multidict.UnicodeMultiDict.getall]--><tt class=\"descname\">getall</tt><big>(</big><em>key</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.UnicodeMultiDict.getall\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Return a list of all values matching the key (may be an empty list)</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.multidict.UnicodeMultiDict.getone\">\n<!--[webob.multidict.UnicodeMultiDict.getone]--><tt class=\"descname\">getone</tt><big>(</big><em>key</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.UnicodeMultiDict.getone\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Get one value matching the key, raising a KeyError if multiple\nvalues were found.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"webob.multidict.UnicodeMultiDict.mixed\">\n<!--[webob.multidict.UnicodeMultiDict.mixed]--><tt class=\"descname\">mixed</tt><big>(</big><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.UnicodeMultiDict.mixed\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns a dictionary where the values are either single\nvalues, or a list of values when a key/value appears more than\nonce in this dictionary.  This is similar to the kind of\ndictionary often used to represent the variables in a web\nrequest.</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.multidict.NestedMultiDict\">\n<!--[webob.multidict.NestedMultiDict]-->class <tt class=\"descclassname\">webob.multidict.</tt><tt class=\"descname\">NestedMultiDict</tt><big>(</big><em>*dicts</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.NestedMultiDict\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Wraps several MultiDict objects, treating it as one large MultiDict</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webob.multidict.NoVars\">\n<!--[webob.multidict.NoVars]-->class <tt class=\"descclassname\">webob.multidict.</tt><tt class=\"descname\">NoVars</tt><big>(</big><em>reason=None</em><big>)</big><a class=\"headerlink\" href=\"#webob.multidict.NoVars\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Represents no variables; used when no variables\nare applicable.</p>\n<p>This is read-only</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-webob.statusreasons\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.statusreasons</span></tt><a class=\"headerlink\" href=\"#module-webob.statusreasons\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Gives <tt class=\"docutils literal\"><span class=\"pre\">status_reasons</span></tt>, a dictionary of HTTP reasons for integer status codes</p>\n</div>\n<div class=\"section\" id=\"module-webob.updatedict\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webob.updatedict</span></tt><a class=\"headerlink\" href=\"#module-webob.updatedict\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Dict that has a callback on all updates</p>\n<dl class=\"class\">\n<dt id=\"webob.updatedict.UpdateDict\">\n<!--[webob.updatedict.UpdateDict]-->class <tt class=\"descclassname\">webob.updatedict.</tt><tt class=\"descname\">UpdateDict</tt><a class=\"headerlink\" href=\"#webob.updatedict.UpdateDict\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "thirdparty/webob", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 35ffcfa75de81429972006ac8f3524cb
-ETag: 3030448848
+ETag: 3334047529
 
 {
   "_id": "35ffcfa75de81429972006ac8f3524cb", 
-  "_rev": "3030448848", 
+  "_rev": "3334047529", 
   "current_page_name": "search", 
   "filename": "/search.fpickle", 
   "project": "Pylons", 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 3a13a27296d64dc267ce60d89282372a
-ETag: 2021898754
+ETag: 1678426742
 
 {
   "_id": "3a13a27296d64dc267ce60d89282372a", 
-  "_rev": "2021898754", 
+  "_rev": "1678426742", 
   "body": "<div class=\"section\" id=\"id1\">\n<span id=\"caching\"></span><h1>Caching<a class=\"headerlink\" href=\"#id1\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<p>Inevitably, there will be occasions during applications development or deployment when some task is revealed to be taking a significant amount of time to complete. When this occurs, the best way to speed things up is with <a class=\"reference external\" href=\"../glossary/#term-caching\"><em class=\"xref\">caching</em></a>.</p>\n<p>Pylons comes with caching middleware enabled that is part of the same package that provides the session handling, <a class=\"reference external\" href=\"http://beaker.groovie.org\">Beaker</a>. Beaker supports a variety of caching backends: memory-based, filesystem-based and the specialised <cite>memcached</cite> library.</p>\n<p>There are several ways to cache data under Pylons, depending on where the slowdown is occurring:</p>\n<ul class=\"simple\">\n<li>Browser-side Caching - HTTP/1.1 supports the <a class=\"reference external\" href=\"../glossary/#term-etag\"><em class=\"xref\">ETag</em></a> caching system that allows the browser to use its own cache instead of requiring regeneration of the entire page. ETag-based caching avoids repeated generation of content but if the browser has never seen the page before, the page will still be generated. Therefore using ETag caching in conjunction with one of the other types of caching listed here will achieve optimal throughput and avoid unnecessary calls on resource-intensive operations.</li>\n</ul>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">the latter only helps if the entire page can be cached.</p>\n</div>\n<ul class=\"simple\">\n<li>Controllers - The <cite>cache</cite> object is available in controllers and templates for use in caching anything in Python that can be pickled.</li>\n<li>Templates - The results of an entire rendered template can be cached using the <a class=\"reference external\" href=\"http://pylonshq.com/docs/class-pylons.templating.Buffet.html#render\">3 cache keyword arguments to the render calls</a>. These render commands can also be used inside templates.</li>\n<li>Mako/Myghty Templates - Built-in caching options are available for both <a class=\"reference external\" href=\"http://www.makotemplates.org/docs/caching.html\">Mako</a> and <a class=\"reference external\" href=\"http://www.myghty.org/docs/cache.myt\">Myghty</a> template engines. They allow fine-grained caching of only certain sections of the template as well as caching of the entire template.</li>\n</ul>\n<p>The two primary concepts to bear in mind when caching are i) caches have a <em>namespace</em> and ii) caches can have <em>keys</em> under that namespace. The reason for this is that, for a single template, there might be multiple versions of the template each requiring its own cached version. The keys in the namespace are the <tt class=\"docutils literal\"><span class=\"pre\">version</span></tt> and the name of the template is the <tt class=\"docutils literal\"><span class=\"pre\">namespace</span></tt>. <strong>Both of these values must be Python strings.</strong></p>\n<p>In templates, the cache <tt class=\"docutils literal\"><span class=\"pre\">namespace</span></tt> will automatically be set to the name of the template being rendered. Nothing else is required for basic caching, unless the developer wishes to control for how long the template is cached and/or maintain caches of multiple versions of the template.</p>\n<p>see also Stephen Pierzchala&#8217;s <a class=\"reference external\" href=\"http://web.archive.org/web/20060424171425/http://www.webperformance.org/caching/caching_for_performance.pdf\">Caching for Performance</a> (<a class=\"reference external\" href=\"mailto:stephen&#37;&#52;&#48;pierzchala&#46;com\">stephen<span>&#64;</span>pierzchala<span>&#46;</span>com</a>)</p>\n<div class=\"section\" id=\"using-the-cache-object\">\n<h2>Using the Cache object<a class=\"headerlink\" href=\"#using-the-cache-object\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Inside a controller, the <cite>cache</cite> object will be available for use. If an action\nor block of code makes heavy use of resources or take a long time to complete,\nit can be convenient to cache the result. The <cite>cache</cite> object can cache any\nPython structure that can be <a class=\"reference external\" href=\"http://docs.python.org/lib/module-pickle.html\">pickled</a>.</p>\n<p>Consider an action where it is desirable to cache some code that does a\ntime-consuming or resource-intensive lookup and returns an object that can be\npickled (list, dict, tuple, etc.):</p>\n<pre>def some_action(self, day):\n    # hypothetical action that uses a 'day' variable as its key\n\n    def expensive_function():\n        # do something that takes a lot of cpu/resources\n\n    # Get a cache for a specific namespace, you can name it whatever\n    # you want, in this case its 'my_function'\n    mycache = cache.get_cache('my_function')\n\n    # Get the value, this will create the cache copy the first time\n    # and any time it expires (in seconds, so 3600 = one hour)\n    c.myvalue = mycache.get_value(key=day, createfunc=expensive_function,\n    type=\"memory\", expiretime=3600)\n\n    return render('/some/template.myt')</pre>\n<p>The <cite>createfunc</cite> option requires a callable object or a function which is then called by the cache whenever a value for the provided key is not in the cache, or has expired in the cache.</p>\n<p>Because the <cite>createfunc</cite> is called with no arguments, the resource- or time-expensive function must correspondingly also not require any arguments.</p>\n<div class=\"section\" id=\"other-cache-options\">\n<h3>Other Cache Options<a class=\"headerlink\" href=\"#other-cache-options\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>The cache also supports the removal values from the cache, using the key(s) to identify the value(s) to be removed and it also supports clearing the cache completely, should it need to be reset.</p>\n<div class=\"highlight\"><pre><span class=\"c\"># Clear the cache</span>\n<span class=\"n\">mycache</span><span class=\"o\">.</span><span class=\"n\">clear</span><span class=\"p\">()</span>\n\n<span class=\"c\"># Remove a specific key</span>\n<span class=\"n\">mycache</span><span class=\"o\">.</span><span class=\"n\">remove_value</span><span class=\"p\">(</span><span class=\"s\">&#39;some_key&#39;</span><span class=\"p\">)</span>\n</pre></div>\n</div>\n</div>\n<div class=\"section\" id=\"using-cache-keywords-to-render\">\n<h2>Using Cache keywords to <cite>render</cite><a class=\"headerlink\" href=\"#using-cache-keywords-to-render\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Needs to be extended to cover the specific render_* calls introduced in Pylons 0.9.7</p>\n</div>\n<p>All <cite>render</cite> commmands have caching functionality built in. To use it, merely\nadd the appropriate cache keyword to the <cite>render</cite> call.</p>\n<div class=\"highlight\"><pre><span class=\"k\">class</span> <span class=\"nc\">SampleController</span><span class=\"p\">(</span><span class=\"n\">BaseController</span><span class=\"p\">):</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">index</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"c\"># Cache the template for 10 mins</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/index.myt&#39;</span><span class=\"p\">,</span> <span class=\"n\">cache_expire</span><span class=\"o\">=</span><span class=\"mf\">600</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">show</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"p\">):</span>\n        <span class=\"c\"># Cache this version of the template for 3 mins</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/show.myt&#39;</span><span class=\"p\">,</span> <span class=\"n\">cache_key</span><span class=\"o\">=</span><span class=\"nb\">id</span><span class=\"p\">,</span> <span class=\"n\">cache_expire</span><span class=\"o\">=</span><span class=\"mf\">180</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">feed</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"c\"># Cache for 20 mins to memory</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/feed.myt&#39;</span><span class=\"p\">,</span> <span class=\"n\">cache_type</span><span class=\"o\">=</span><span class=\"s\">&#39;memory&#39;</span><span class=\"p\">,</span> <span class=\"n\">cache_expire</span><span class=\"o\">=</span><span class=\"mf\">1200</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">home</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"n\">user</span><span class=\"p\">):</span>\n        <span class=\"c\"># Cache this version of a page forever (until the cache dir is cleaned)</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/home.myt&#39;</span><span class=\"p\">,</span> <span class=\"n\">cache_key</span><span class=\"o\">=</span><span class=\"n\">user</span><span class=\"p\">,</span> <span class=\"n\">cache_expire</span><span class=\"o\">=</span><span class=\"s\">&#39;never&#39;</span><span class=\"p\">)</span>\n</pre></div>\n</div>\n<div class=\"section\" id=\"using-the-cache-decorator\">\n<h2>Using the Cache Decorator<a class=\"headerlink\" href=\"#using-the-cache-decorator\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Pylons also provides the <a class=\"reference external\" href=\"http://pylonshq.com/docs/module-pylons.decorators.cache.html#beaker_cache\">beaker_cache</a>\ndecorator for caching in <cite>pylons.cache</cite> the results of a completed function call (memoizing).</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">ambiguous with respect to &#8216;as does the render function&#8217;</p>\n</div>\n<p>The cache decorator takes the same cache arguments (minus their <cite>cache_</cite> prefix), as does the <cite>render</cite> function.</p>\n<div class=\"highlight\"><pre><span class=\"k\">from</span> <span class=\"nn\">pylons.decorators.cache</span> <span class=\"k\">import</span> <span class=\"n\">beaker_cache</span>\n\n<span class=\"k\">class</span> <span class=\"nc\">SampleController</span><span class=\"p\">(</span><span class=\"n\">BaseController</span><span class=\"p\">):</span>\n\n    <span class=\"c\"># Cache this controller action forever (until the cache dir is cleaned)</span>\n    <span class=\"nd\">@beaker_cache</span><span class=\"p\">()</span>\n    <span class=\"k\">def</span> <span class=\"nf\">home</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"n\">expensive_call</span><span class=\"p\">()</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/home.myt&#39;</span><span class=\"p\">)</span>\n\n    <span class=\"c\"># Cache this controller action by its GET args for 10 mins to memory</span>\n    <span class=\"nd\">@beaker_cache</span><span class=\"p\">(</span><span class=\"n\">expire</span><span class=\"o\">=</span><span class=\"mf\">600</span><span class=\"p\">,</span> <span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;memory&#39;</span><span class=\"p\">,</span> <span class=\"n\">query_args</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">)</span>\n    <span class=\"k\">def</span> <span class=\"nf\">show</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"p\">):</span>\n        <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"n\">expensive_call</span><span class=\"p\">(</span><span class=\"nb\">id</span><span class=\"p\">)</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/show.myt&#39;</span><span class=\"p\">)</span>\n</pre></div>\n<p>By default the decorator uses a composite of all of the decorated function&#8217;s arguments as the cache key. It can alternatively use a composite of the <cite>request.GET</cite> query args as the cache key when the <cite>query_args</cite> option is enabled.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">ambiguous - are customizations in addition or in place of the above key-using options?</p>\n</div>\n<p>The cache key can be further customized via the <cite>key</cite> argument.</p>\n</div>\n<div class=\"section\" id=\"etag-caching\">\n<h2>ETag Caching<a class=\"headerlink\" href=\"#etag-caching\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Caching via ETag involves sending the browser an ETag header so that it knows\nto save and possibly use a cached copy of the page from its own cache, instead\nof requesting the application to send a fresh copy.</p>\n<p>Because the ETag cache relies on sending headers to the browser, it works in a\nslightly different manner to the other caching mechanisms described above.</p>\n<p>The <tt class=\"xref docutils literal\"><span class=\"pre\">etag_cache()</span></tt> function will set the proper HTTP headers if\nthe browser doesn&#8217;t yet have a copy of the page. Otherwise, a 304 HTTP\nException will be thrown that is then caught by Paste middleware and\nturned into a proper 304 response to the browser. This will cause the\nbrowser to use its own locally-cached copy.</p>\n<p><tt class=\"xref docutils literal\"><span class=\"pre\">etag_cache()</span></tt> returns <cite>pylons.response</cite> for legacy purposes\n(<cite>pylons.response</cite> should be used directly instead).</p>\n<p>ETag-based caching requires a single key which is sent in the ETag HTTP header\nback to the browser. The <a class=\"reference external\" href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html\">RFC specification for HTTP headers</a> indicates that an\nETag header merely needs to be a string. This value of this string does not need\nto be unique for every URL as the browser itself determines whether to use its own\ncopy, this decision is based on the URL and the ETag key.</p>\n<div class=\"highlight\"><pre><span class=\"k\">def</span> <span class=\"nf\">my_action</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n    <span class=\"n\">etag_cache</span><span class=\"p\">(</span><span class=\"s\">&#39;somekey&#39;</span><span class=\"p\">)</span>\n    <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/show.myt&#39;</span><span class=\"p\">,</span> <span class=\"n\">cache_expire</span><span class=\"o\">=</span><span class=\"mf\">3600</span><span class=\"p\">)</span>\n</pre></div>\n<p>Or to change other aspects of the response:</p>\n<div class=\"highlight\"><pre><span class=\"k\">def</span> <span class=\"nf\">my_action</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n    <span class=\"n\">etag_cache</span><span class=\"p\">(</span><span class=\"s\">&#39;somekey&#39;</span><span class=\"p\">)</span>\n    <span class=\"n\">response</span><span class=\"o\">.</span><span class=\"n\">headers</span><span class=\"p\">[</span><span class=\"s\">&#39;content-type&#39;</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"s\">&#39;text/plain&#39;</span>\n    <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/show.myt&#39;</span><span class=\"p\">,</span> <span class=\"n\">cache_expire</span><span class=\"o\">=</span><span class=\"mf\">3600</span><span class=\"p\">)</span>\n</pre></div>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">In this example that we are using template caching in addition to ETag\ncaching. If a new visitor comes to the site, we avoid re-rendering the\ntemplate if a cached copy exists and repeat hits to the page by that user\nwill then trigger the ETag cache. This example also will never change the\nETag key, so the browsers cache will always be used if it has one.</p>\n</div>\n<p>The frequency with which an ETag cache key is changed will depend on the web\napplication and the developer&#8217;s assessment of how often the browser should be\nprompted to fetch a fresh copy of the page.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Stolen from Philip Cooper&#8217;s <a class=\"reference external\" href=\"http://www.openvest.com/trac/wiki/BeakerCache\">OpenVest wiki</a>  after which it was updated and edited ...</p>\n</div>\n</div>\n<div class=\"section\" id=\"inside-the-beaker-cache\">\n<h2>Inside the Beaker Cache<a class=\"headerlink\" href=\"#inside-the-beaker-cache\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"section\" id=\"id2\">\n<h3>Caching<a class=\"headerlink\" href=\"#id2\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>First lets start out with some <strong>slow</strong> function that we would like to cache.  This function is not slow but it will show us when it was cached so we can see things are working as we expect:</p>\n<div class=\"highlight\"><pre><span class=\"k\">import</span> <span class=\"nn\">time</span>\n<span class=\"k\">def</span> <span class=\"nf\">slooow</span><span class=\"p\">(</span><span class=\"n\">myarg</span><span class=\"p\">):</span>\n  <span class=\"c\"># some slow database or template stuff here</span>\n  <span class=\"k\">return</span> <span class=\"s\">&quot;</span><span class=\"si\">%s</span><span class=\"s\"> at </span><span class=\"si\">%s</span><span class=\"s\">&quot;</span> <span class=\"o\">%</span> <span class=\"p\">(</span><span class=\"n\">myarg</span><span class=\"p\">,</span><span class=\"n\">time</span><span class=\"o\">.</span><span class=\"n\">asctime</span><span class=\"p\">())</span>\n</pre></div>\n<p>When we have the cached function, multiple calls will tell us whether are seeing a cached or a new version.</p>\n</div>\n<div class=\"section\" id=\"dbmcache\">\n<h3>DBMCache<a class=\"headerlink\" href=\"#dbmcache\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>The DBMCache stores (actually pickles) the response in a dbm style database.</p>\n<p>What may not be obvious is that the are two levels of keys.  They are essentially created as one for the function or template name (called the namespace) and one for the &#8216;&#8217;keys&#8217;&#8217; within that (called the key).  So for <cite>Some_Function_name</cite>, there is a cache created as one dbm file/database.  As that function is called with different arguments, those arguments are keys within the dbm file. First lets create and populate a cache.  This cache might be a cache for the function <cite>Some_Function_name</cite> called three times with three different arguments: <cite>x, yy, and zzz</cite>:</p>\n<div class=\"highlight\"><pre><span class=\"k\">from</span> <span class=\"nn\">beaker.cache</span> <span class=\"k\">import</span> <span class=\"n\">CacheManager</span>\n<span class=\"n\">cm</span> <span class=\"o\">=</span> <span class=\"n\">CacheManager</span><span class=\"p\">(</span><span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;dbm&#39;</span><span class=\"p\">,</span> <span class=\"n\">data_dir</span><span class=\"o\">=</span><span class=\"s\">&#39;beaker.cache&#39;</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span> <span class=\"o\">=</span> <span class=\"n\">cm</span><span class=\"o\">.</span><span class=\"n\">get_cache</span><span class=\"p\">(</span><span class=\"s\">&#39;Some_Function_name&#39;</span><span class=\"p\">)</span>\n<span class=\"c\"># the cache is setup but the dbm file is not created until needed</span>\n<span class=\"c\"># so let&#39;s populate it with three values:</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;x&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;x&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;yy&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;yy&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;zzz&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;zzz&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n</pre></div>\n<p>Nothing much new yet.  After getting the cache we can use the cache as per the Beaker Documentation.</p>\n<div class=\"highlight\"><pre><span class=\"k\">import</span> <span class=\"nn\">beaker.container</span> <span class=\"k\">as</span> <span class=\"nn\">container</span>\n<span class=\"n\">cc</span><span class=\"o\">=</span><span class=\"n\">container</span><span class=\"o\">.</span><span class=\"n\">ContainerContext</span><span class=\"p\">()</span>\n<span class=\"n\">nsm</span><span class=\"o\">=</span><span class=\"n\">cc</span><span class=\"o\">.</span><span class=\"n\">get_namespace_manager</span><span class=\"p\">(</span><span class=\"s\">&#39;Some_Function_name&#39;</span><span class=\"p\">,</span><span class=\"n\">container</span><span class=\"o\">.</span><span class=\"n\">DBMContainer</span><span class=\"p\">,</span><span class=\"n\">data_dir</span><span class=\"o\">=</span><span class=\"s\">&#39;beaker.cache&#39;</span><span class=\"p\">)</span>\n<span class=\"n\">filename</span><span class=\"o\">=</span><span class=\"n\">nsm</span><span class=\"o\">.</span><span class=\"n\">file</span>\n</pre></div>\n<p>Now we have the file name.  The file name is a <cite>sha</cite> hash of a string which is a join of the container class name and the function name (used in the <cite>get_cache</cite> function call).  It would return something like:</p>\n<div class=\"highlight\"><pre><span class=\"s\">&#39;beaker.cache/container_dbm/a/a7/a768f120e39d0248d3d2f23d15ee0a20be5226de.dbm&#39;</span>\n</pre></div>\n<p>With that file name you could look directly inside the cache database (but only for your education and debugging experience, <strong>not</strong> your cache interactions!)</p>\n<div class=\"highlight\"><pre><span class=\"c\">## this file name can be used directly (for debug ONLY)</span>\n<span class=\"k\">import</span> <span class=\"nn\">anydbm</span>\n<span class=\"k\">import</span> <span class=\"nn\">pickle</span>\n<span class=\"n\">db</span><span class=\"o\">=</span><span class=\"n\">anydbm</span><span class=\"o\">.</span><span class=\"n\">open</span><span class=\"p\">(</span><span class=\"n\">filename</span><span class=\"p\">)</span>\n<span class=\"n\">old_t</span><span class=\"p\">,</span> <span class=\"n\">old_v</span> <span class=\"o\">=</span> <span class=\"n\">pickle</span><span class=\"o\">.</span><span class=\"n\">loads</span><span class=\"p\">(</span><span class=\"n\">db</span><span class=\"p\">[</span><span class=\"s\">&#39;zzz&#39;</span><span class=\"p\">])</span>\n</pre></div>\n<p>The database only contains the old time and old value.  Where did the expire time and the function to create/update the value go?.  They never make it to the database.  They reside in the <cite>cache</cite> object returned from <cite>get_cache</cite> call above.</p>\n<p>Note that the createfunc, and expiretime values are stored during the first call to <cite>get_value</cite>. Subsequent calls with (say) a different expiry time will <strong>not</strong> update that value.  This is a tricky part of the caching but perhaps is a good thing since different processes may have different policies in effect.</p>\n<p>If there are difficulties with these values, remember that one call to <tt class=\"xref docutils literal\"><span class=\"pre\">cache.clear()</span></tt> resets everything.</p>\n</div>\n<div class=\"section\" id=\"database-cache\">\n<h3>Database Cache<a class=\"headerlink\" href=\"#database-cache\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Using the <cite>ext:database</cite> cache type.</p>\n<div class=\"highlight\"><pre><span class=\"k\">from</span> <span class=\"nn\">beaker.cache</span> <span class=\"k\">import</span> <span class=\"n\">CacheManager</span>\n<span class=\"c\">#cm = CacheManager(type=&#39;dbm&#39;, data_dir=&#39;beaker.cache&#39;)</span>\n<span class=\"n\">cm</span> <span class=\"o\">=</span> <span class=\"n\">CacheManager</span><span class=\"p\">(</span><span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;ext:database&#39;</span><span class=\"p\">,</span>\n        <span class=\"n\">url</span><span class=\"o\">=</span><span class=\"s\">&quot;sqlite:///beaker.cache/beaker.sqlite&quot;</span><span class=\"p\">,</span><span class=\"n\">data_dir</span><span class=\"o\">=</span><span class=\"s\">&#39;beaker.cache&#39;</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span> <span class=\"o\">=</span> <span class=\"n\">cm</span><span class=\"o\">.</span><span class=\"n\">get_cache</span><span class=\"p\">(</span><span class=\"s\">&#39;Some_Function_name&#39;</span><span class=\"p\">)</span>\n<span class=\"c\"># the cache is setup but the dbm file is not created until needed</span>\n<span class=\"c\"># so let&#39;s populate it with three values:</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;x&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;x&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;yy&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;yy&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;zzz&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;zzz&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n</pre></div>\n<p>This is identical to the cache usage above with the only difference being the creation of the <cite>CacheManager</cite>.  It is much easier to view the caches outside the beaker code (again for edification and debugging, not for api usage).</p>\n<p>SQLite was used in this instance and the SQLite data file can be directly accessed uaing the SQLite command-line utility or the Firefox plug-in:</p>\n<div class=\"highlight\"><pre>sqlite3 beaker.cache/beaker.sqlite\n# from inside sqlite:\nsqlite&gt; .schema\nCREATE TABLE beaker_cache (\n        id INTEGER NOT NULL,\n        namespace VARCHAR(255) NOT NULL,\n        key VARCHAR(255) NOT NULL,\n        value BLOB NOT NULL,\n        PRIMARY KEY (id),\n         UNIQUE (namespace, key)\n);\nselect * from beaker_cache;\n</pre></div>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">The data structure is different in Beaker 0.8 ...</p>\n</div>\n<div class=\"highlight\"><pre><span class=\"n\">cache</span> <span class=\"o\">=</span> <span class=\"n\">sa</span><span class=\"o\">.</span><span class=\"n\">Table</span><span class=\"p\">(</span><span class=\"n\">table_name</span><span class=\"p\">,</span> <span class=\"n\">meta</span><span class=\"p\">,</span>\n                 <span class=\"n\">sa</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"s\">&#39;id&#39;</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">Integer</span><span class=\"p\">,</span> <span class=\"n\">primary_key</span><span class=\"o\">=</span><span class=\"bp\">True</span><span class=\"p\">),</span>\n                 <span class=\"n\">sa</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"s\">&#39;namespace&#39;</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">String</span><span class=\"p\">(</span><span class=\"mf\">255</span><span class=\"p\">),</span> <span class=\"n\">nullable</span><span class=\"o\">=</span><span class=\"bp\">False</span><span class=\"p\">),</span>\n                 <span class=\"n\">sa</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"s\">&#39;accessed&#39;</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">DateTime</span><span class=\"p\">,</span> <span class=\"n\">nullable</span><span class=\"o\">=</span><span class=\"bp\">False</span><span class=\"p\">),</span>\n                 <span class=\"n\">sa</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"s\">&#39;created&#39;</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">DateTime</span><span class=\"p\">,</span> <span class=\"n\">nullable</span><span class=\"o\">=</span><span class=\"bp\">False</span><span class=\"p\">),</span>\n                 <span class=\"n\">sa</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"s\">&#39;data&#39;</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">BLOB</span><span class=\"p\">(),</span> <span class=\"n\">nullable</span><span class=\"o\">=</span><span class=\"bp\">False</span><span class=\"p\">),</span>\n                 <span class=\"n\">sa</span><span class=\"o\">.</span><span class=\"n\">UniqueConstraint</span><span class=\"p\">(</span><span class=\"s\">&#39;namespace&#39;</span><span class=\"p\">)</span>\n<span class=\"p\">)</span>\n</pre></div>\n<p>It includes the access time but stores rows on a one-row-per-namespace basis, (storing a pickled dict) rather than one-row-per-namespace/key-combination. This is a more efficient approach when the problem is handling a large number of namespaces with limited keys &#8212; like sessions.</p>\n</div>\n<div class=\"section\" id=\"memcached-cache\">\n<h3>Memcached Cache<a class=\"headerlink\" href=\"#memcached-cache\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>For large numbers of keys with expensive pre-key lookups memcached it the way to go.</p>\n<p>If memcached is running on the the default port of 11211:</p>\n<div class=\"highlight\"><pre><span class=\"k\">from</span> <span class=\"nn\">beaker.cache</span> <span class=\"k\">import</span> <span class=\"n\">CacheManager</span>\n<span class=\"n\">cm</span> <span class=\"o\">=</span> <span class=\"n\">CacheManager</span><span class=\"p\">(</span><span class=\"nb\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;ext:memcached&#39;</span><span class=\"p\">,</span><span class=\"n\">url</span><span class=\"o\">=</span><span class=\"s\">&#39;127.0.0.1:11211&#39;</span><span class=\"p\">,</span><span class=\"n\">lock_dir</span><span class=\"o\">=</span><span class=\"s\">&#39;beaker.cache&#39;</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span> <span class=\"o\">=</span> <span class=\"n\">cm</span><span class=\"o\">.</span><span class=\"n\">get_cache</span><span class=\"p\">(</span><span class=\"s\">&#39;Some_Function_name&#39;</span><span class=\"p\">)</span>\n<span class=\"c\"># the cache is setup but the dbm file is not created until needed</span>\n<span class=\"c\"># so let&#39;s populate it with three values:</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;x&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;x&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;yy&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;yy&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n<span class=\"n\">cache</span><span class=\"o\">.</span><span class=\"n\">get_value</span><span class=\"p\">(</span><span class=\"s\">&#39;zzz&#39;</span><span class=\"p\">,</span><span class=\"n\">createfunc</span><span class=\"o\">=</span><span class=\"k\">lambda</span><span class=\"p\">:</span><span class=\"n\">slooow</span><span class=\"p\">(</span><span class=\"s\">&#39;zzz&#39;</span><span class=\"p\">),</span><span class=\"n\">expiretime</span><span class=\"o\">=</span><span class=\"mf\">15</span><span class=\"p\">)</span>\n</pre></div>\n</div>\n</div>\n</div>\n", 
   "current_page_name": "caching", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 3c5fdf53121884be5844f02a4eb62ed5
-ETag: 3303635529
+ETag: 2931886486
 
 {
   "_id": "3c5fdf53121884be5844f02a4eb62ed5", 
-  "_rev": "3303635529", 
+  "_rev": "2931886486", 
   "body": "<div class=\"section\" id=\"module-weberror\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">weberror</span></tt> &#8211; Weberror<a class=\"headerlink\" href=\"#module-weberror\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"module-weberror.errormiddleware\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.errormiddleware</span></tt><a class=\"headerlink\" href=\"#module-weberror.errormiddleware\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Error handler middleware</p>\n<dl class=\"class\">\n<dt id=\"weberror.errormiddleware.ErrorMiddleware\">\n<!--[weberror.errormiddleware.ErrorMiddleware]-->class <tt class=\"descclassname\">weberror.errormiddleware.</tt><tt class=\"descname\">ErrorMiddleware</tt><big>(</big><em>application</em>, <em>global_conf=None</em>, <em>debug=&lt;NoDefault&gt;</em>, <em>error_email=None</em>, <em>error_log=None</em>, <em>show_exceptions_in_wsgi_errors=&lt;NoDefault&gt;</em>, <em>from_address=None</em>, <em>smtp_server=None</em>, <em>smtp_username=None</em>, <em>smtp_password=None</em>, <em>smtp_use_tls=False</em>, <em>error_subject_prefix=None</em>, <em>error_message=None</em>, <em>xmlhttp_key=None</em>, <em>reporters=None</em><big>)</big><a class=\"headerlink\" href=\"#weberror.errormiddleware.ErrorMiddleware\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Error handling middleware</p>\n<p>Usage:</p>\n<div class=\"highlight\"><pre><span class=\"n\">error_caching_wsgi_app</span> <span class=\"o\">=</span> <span class=\"n\">ErrorMiddleware</span><span class=\"p\">(</span><span class=\"n\">wsgi_app</span><span class=\"p\">)</span>\n</pre></div>\n<p>Settings:</p>\n<blockquote>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">debug</span></tt>:</dt>\n<dd>If true, then tracebacks will be shown in the browser.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">error_email</span></tt>:</dt>\n<dd>an email address (or list of addresses) to send exception \nreports to</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">error_log</span></tt>:</dt>\n<dd>a filename to append tracebacks to</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">show_exceptions_in_wsgi_errors</span></tt>:</dt>\n<dd>If true, then errors will be printed to <tt class=\"docutils literal\"><span class=\"pre\">wsgi.errors</span></tt> \n(frequently a server error log, or stderr).</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">from_address</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">smtp_server</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">error_subject_prefix</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">smtp_username</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">smtp_password</span></tt>, <tt class=\"docutils literal\"><span class=\"pre\">smtp_use_tls</span></tt>:</dt>\n<dd>variables to control the emailed exception reports</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">error_message</span></tt>:</dt>\n<dd>When debug mode is off, the error message to show to users.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">xmlhttp_key</span></tt>:</dt>\n<dd>When this key (default <tt class=\"docutils literal\"><span class=\"pre\">_</span></tt>) is in the request GET variables\n(not POST!), expect that this is an XMLHttpRequest, and the\nresponse should be more minimal; it should not be a complete\nHTML page.</dd>\n</dl>\n</blockquote>\n<p>Environment Configuration:</p>\n<blockquote>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">paste.throw_errors</span></tt>:</dt>\n<dd>If this setting in the request environment is true, then this\nmiddleware is disabled. This can be useful in a testing situation\nwhere you don&#8217;t want errors to be caught and transformed.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">paste.expected_exceptions</span></tt>:</dt>\n<dd>When this middleware encounters an exception listed in this\nenvironment variable and when the <tt class=\"docutils literal\"><span class=\"pre\">start_response</span></tt> has not \nyet occurred, the exception will be re-raised instead of being\ncaught.  This should generally be set by middleware that may \n(but probably shouldn&#8217;t be) installed above this middleware, \nand wants to get certain exceptions.  Exceptions raised after\n<tt class=\"docutils literal\"><span class=\"pre\">start_response</span></tt> have been called are always caught since\nby definition they are no longer expected.</dd>\n</dl>\n</blockquote>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-weberror.evalcontext\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.evalcontext</span></tt><a class=\"headerlink\" href=\"#module-weberror.evalcontext\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"weberror.evalcontext.EvalContext\">\n<!--[weberror.evalcontext.EvalContext]-->class <tt class=\"descclassname\">weberror.evalcontext.</tt><tt class=\"descname\">EvalContext</tt><big>(</big><em>namespace</em>, <em>globs</em><big>)</big><a class=\"headerlink\" href=\"#weberror.evalcontext.EvalContext\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Class that represents a interactive interface.  It has its own\nnamespace.  Use eval_context.exec_expr(expr) to run commands; the\noutput of those commands is returned, as are print statements.</p>\n<p>This is essentially what doctest does, and is taken directly from\ndoctest.</p>\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-weberror.evalexception\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.evalexception</span></tt><a class=\"headerlink\" href=\"#module-weberror.evalexception\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Exception-catching middleware that allows interactive debugging.</p>\n<p>This middleware catches all unexpected exceptions.  A normal\ntraceback, like produced by\n<tt class=\"docutils literal\"><span class=\"pre\">weberror.exceptions.errormiddleware.ErrorMiddleware</span></tt> is given, plus\ncontrols to see local variables and evaluate expressions in a local\ncontext.</p>\n<p>This can only be used in single-process environments, because\nsubsequent requests must go back to the same process that the\nexception originally occurred in.  Threaded or non-concurrent\nenvironments both work.</p>\n<p>This shouldn&#8217;t be used in production in any way.  That would just be\nsilly.</p>\n<p>If calling from an XMLHttpRequest call, if the GET variable <tt class=\"docutils literal\"><span class=\"pre\">_</span></tt> is\ngiven then it will make the response more compact (and less\nJavascripty), since if you use innerHTML it&#8217;ll kill your browser.  You\ncan look for the header X-Debug-URL in your 500 responses if you want\nto see the full debuggable traceback.  Also, this URL is printed to\n<tt class=\"docutils literal\"><span class=\"pre\">wsgi.errors</span></tt>, so you can open it up in another browser window.</p>\n<dl class=\"class\">\n<dt id=\"weberror.evalexception.EvalException\">\n<!--[weberror.evalexception.EvalException]-->class <tt class=\"descclassname\">weberror.evalexception.</tt><tt class=\"descname\">EvalException</tt><big>(</big><em>application</em>, <em>global_conf=None</em>, <em>error_template_filename=None</em>, <em>xmlhttp_key=None</em>, <em>media_paths=None</em>, <em>templating_formatters=None</em>, <em>head_html=''</em>, <em>footer_html=''</em>, <em>reporters=None</em>, <em>libraries=None</em>, <em>**params</em><big>)</big><a class=\"headerlink\" href=\"#weberror.evalexception.EvalException\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Handles capturing an exception and turning it into an interactive\nexception explorer</p>\n<dl class=\"method\">\n<dt id=\"weberror.evalexception.EvalException.media\">\n<!--[weberror.evalexception.EvalException.media]--><tt class=\"descname\">media</tt><big>(</big><em>req</em><big>)</big><a class=\"headerlink\" href=\"#weberror.evalexception.EvalException.media\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Static path where images and other files live</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"weberror.evalexception.EvalException.relay\">\n<!--[weberror.evalexception.EvalException.relay]--><tt class=\"descname\">relay</tt><big>(</big><em>req</em><big>)</big><a class=\"headerlink\" href=\"#weberror.evalexception.EvalException.relay\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Relay a request to a remote machine for JS proxying</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"weberror.evalexception.EvalException.summary\">\n<!--[weberror.evalexception.EvalException.summary]--><tt class=\"descname\">summary</tt><big>(</big><em>req</em><big>)</big><a class=\"headerlink\" href=\"#weberror.evalexception.EvalException.summary\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns a JSON-format summary of all the cached\nexception reports</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"weberror.evalexception.EvalException.view\">\n<!--[weberror.evalexception.EvalException.view]--><tt class=\"descname\">view</tt><big>(</big><em>req</em><big>)</big><a class=\"headerlink\" href=\"#weberror.evalexception.EvalException.view\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>View old exception reports</dd></dl>\n\n</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-weberror.formatter\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.formatter</span></tt><a class=\"headerlink\" href=\"#module-weberror.formatter\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Formatters for the exception data that comes from ExceptionCollector.</p>\n<dl class=\"class\">\n<dt id=\"weberror.formatter.AbstractFormatter\">\n<!--[weberror.formatter.AbstractFormatter]-->class <tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">AbstractFormatter</tt><big>(</big><em>show_hidden_frames=False</em>, <em>include_reusable=True</em>, <em>show_extra_data=True</em>, <em>trim_source_paths=()</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.AbstractFormatter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><dl class=\"method\">\n<dt id=\"weberror.formatter.AbstractFormatter.filter_frames\">\n<!--[weberror.formatter.AbstractFormatter.filter_frames]--><tt class=\"descname\">filter_frames</tt><big>(</big><em>frames</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.AbstractFormatter.filter_frames\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Removes any frames that should be hidden, according to the\nvalues of traceback_hide, self.show_hidden_frames, and the\nhidden status of the final frame.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"weberror.formatter.AbstractFormatter.format_frame_end\">\n<!--[weberror.formatter.AbstractFormatter.format_frame_end]--><tt class=\"descname\">format_frame_end</tt><big>(</big><em>frame</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.AbstractFormatter.format_frame_end\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Called after each frame ends; may return None to output no text.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"weberror.formatter.AbstractFormatter.format_frame_start\">\n<!--[weberror.formatter.AbstractFormatter.format_frame_start]--><tt class=\"descname\">format_frame_start</tt><big>(</big><em>frame</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.AbstractFormatter.format_frame_start\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Called before each frame starts; may return None to output no text.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"weberror.formatter.AbstractFormatter.long_item_list\">\n<!--[weberror.formatter.AbstractFormatter.long_item_list]--><tt class=\"descname\">long_item_list</tt><big>(</big><em>lst</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.AbstractFormatter.long_item_list\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Returns true if the list contains items that are long, and should\nbe more nicely formatted.</dd></dl>\n\n<dl class=\"method\">\n<dt id=\"weberror.formatter.AbstractFormatter.pretty_string_repr\">\n<!--[weberror.formatter.AbstractFormatter.pretty_string_repr]--><tt class=\"descname\">pretty_string_repr</tt><big>(</big><em>s</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.AbstractFormatter.pretty_string_repr\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Formats the string as a triple-quoted string when it contains\nnewlines.</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"weberror.formatter.TextFormatter\">\n<!--[weberror.formatter.TextFormatter]-->class <tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">TextFormatter</tt><big>(</big><em>show_hidden_frames=False</em>, <em>include_reusable=True</em>, <em>show_extra_data=True</em>, <em>trim_source_paths=()</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.TextFormatter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"weberror.formatter.HTMLFormatter\">\n<!--[weberror.formatter.HTMLFormatter]-->class <tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">HTMLFormatter</tt><big>(</big><em>show_hidden_frames=False</em>, <em>include_reusable=True</em>, <em>show_extra_data=True</em>, <em>trim_source_paths=()</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.HTMLFormatter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"weberror.formatter.XMLFormatter\">\n<!--[weberror.formatter.XMLFormatter]-->class <tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">XMLFormatter</tt><big>(</big><em>show_hidden_frames=False</em>, <em>include_reusable=True</em>, <em>show_extra_data=True</em>, <em>trim_source_paths=()</em>, <em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.XMLFormatter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.create_text_node\">\n<!--[weberror.formatter.create_text_node]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">create_text_node</tt><big>(</big><em>doc</em>, <em>elem</em>, <em>text</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.create_text_node\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.html_quote\">\n<!--[weberror.formatter.html_quote]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">html_quote</tt><big>(</big><em>s</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.html_quote\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.format_html\">\n<!--[weberror.formatter.format_html]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">format_html</tt><big>(</big><em>exc_data</em>, <em>include_hidden_frames=False</em>, <em>**ops</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.format_html\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.format_text\">\n<!--[weberror.formatter.format_text]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">format_text</tt><big>(</big><em>exc_data</em>, <em>**ops</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.format_text\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.format_xml\">\n<!--[weberror.formatter.format_xml]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">format_xml</tt><big>(</big><em>exc_data</em>, <em>**ops</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.format_xml\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.str2html\">\n<!--[weberror.formatter.str2html]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">str2html</tt><big>(</big><em>src</em>, <em>strip=False</em>, <em>indent_subsequent=0</em>, <em>highlight_inner=False</em>, <em>frame=None</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.str2html\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Convert a string to HTML.  Try to be really safe about it,\nreturning a quoted version of the string if nothing else works.</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter._str2html\">\n<!--[weberror.formatter._str2html]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">_str2html</tt><big>(</big><em>src</em>, <em>strip=False</em>, <em>indent_subsequent=0</em>, <em>highlight_inner=False</em>, <em>frame=None</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter._str2html\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.truncate\">\n<!--[weberror.formatter.truncate]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">truncate</tt><big>(</big><em>string</em>, <em>limit=1000</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.truncate\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Truncate the string to the limit number of\ncharacters</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.make_wrappable\">\n<!--[weberror.formatter.make_wrappable]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">make_wrappable</tt><big>(</big><em>html</em>, <em>wrap_limit=60</em>, <em>split_on=';?&amp;&#64;!$#-/&quot;''</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.make_wrappable\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.formatter.make_pre_wrappable\">\n<!--[weberror.formatter.make_pre_wrappable]--><tt class=\"descclassname\">weberror.formatter.</tt><tt class=\"descname\">make_pre_wrappable</tt><big>(</big><em>html</em>, <em>wrap_limit=60</em>, <em>split_on=';?&amp;&#64;!$#-/&quot;''</em><big>)</big><a class=\"headerlink\" href=\"#weberror.formatter.make_pre_wrappable\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Like <tt class=\"docutils literal\"><span class=\"pre\">make_wrappable()</span></tt> but intended for text that will\ngo in a <tt class=\"docutils literal\"><span class=\"pre\">&lt;pre&gt;</span></tt> block, so wrap on a line-by-line basis.</dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-weberror.reporter\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.reporter</span></tt><a class=\"headerlink\" href=\"#module-weberror.reporter\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"weberror.reporter.Reporter\">\n<!--[weberror.reporter.Reporter]-->class <tt class=\"descclassname\">weberror.reporter.</tt><tt class=\"descname\">Reporter</tt><big>(</big><em>**conf</em><big>)</big><a class=\"headerlink\" href=\"#weberror.reporter.Reporter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"weberror.reporter.EmailReporter\">\n<!--[weberror.reporter.EmailReporter]-->class <tt class=\"descclassname\">weberror.reporter.</tt><tt class=\"descname\">EmailReporter</tt><big>(</big><em>**conf</em><big>)</big><a class=\"headerlink\" href=\"#weberror.reporter.EmailReporter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"weberror.reporter.LogReporter\">\n<!--[weberror.reporter.LogReporter]-->class <tt class=\"descclassname\">weberror.reporter.</tt><tt class=\"descname\">LogReporter</tt><big>(</big><em>**conf</em><big>)</big><a class=\"headerlink\" href=\"#weberror.reporter.LogReporter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"weberror.reporter.FileReporter\">\n<!--[weberror.reporter.FileReporter]-->class <tt class=\"descclassname\">weberror.reporter.</tt><tt class=\"descname\">FileReporter</tt><big>(</big><em>**conf</em><big>)</big><a class=\"headerlink\" href=\"#weberror.reporter.FileReporter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n<dl class=\"class\">\n<dt id=\"weberror.reporter.WSGIAppReporter\">\n<!--[weberror.reporter.WSGIAppReporter]-->class <tt class=\"descclassname\">weberror.reporter.</tt><tt class=\"descname\">WSGIAppReporter</tt><big>(</big><em>exc_data</em><big>)</big><a class=\"headerlink\" href=\"#weberror.reporter.WSGIAppReporter\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n<div class=\"section\" id=\"module-weberror.collector\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.collector</span></tt><a class=\"headerlink\" href=\"#module-weberror.collector\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>An exception collector that finds traceback information plus\nsupplements</p>\n<dl class=\"class\">\n<dt id=\"weberror.collector.ExceptionCollector\">\n<!--[weberror.collector.ExceptionCollector]-->class <tt class=\"descclassname\">weberror.collector.</tt><tt class=\"descname\">ExceptionCollector</tt><big>(</big><em>limit=None</em><big>)</big><a class=\"headerlink\" href=\"#weberror.collector.ExceptionCollector\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Produces a data structure that can be used by formatters to\ndisplay exception reports.</p>\n<p>Magic variables:</p>\n<p>If you define one of these variables in your local scope, you can\nadd information to tracebacks that happen in that context.  This\nallows applications to add all sorts of extra information about\nthe context of the error, including URLs, environmental variables,\nusers, hostnames, etc.  These are the variables we look for:</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__traceback_supplement__</span></tt>:</dt>\n<dd><p class=\"first\">You can define this locally or globally (unlike all the other\nvariables, which must be defined locally).</p>\n<p class=\"last\"><tt class=\"docutils literal\"><span class=\"pre\">__traceback_supplement__</span></tt> is a tuple of <tt class=\"docutils literal\"><span class=\"pre\">(factory,</span> <span class=\"pre\">arg1,</span>\n<span class=\"pre\">arg2...)</span></tt>.  When there is an exception, <tt class=\"docutils literal\"><span class=\"pre\">factory(arg1,</span> <span class=\"pre\">arg2,</span>\n<span class=\"pre\">...)</span></tt> is called, and the resulting object is inspected for\nsupplemental information.</p>\n</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__traceback_info__</span></tt>:</dt>\n<dd>This information is added to the traceback, usually fairly\nliterally.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__traceback_hide__</span></tt>:</dt>\n<dd><p class=\"first\">If set and true, this indicates that the frame should be\nhidden from abbreviated tracebacks.  This way you can hide\nsome of the complexity of the larger framework and let the\nuser focus on their own errors.</p>\n<p>By setting it to <tt class=\"docutils literal\"><span class=\"pre\">'before'</span></tt>, all frames before this one will\nbe thrown away.  By setting it to <tt class=\"docutils literal\"><span class=\"pre\">'after'</span></tt> then all frames\nafter this will be thrown away until <tt class=\"docutils literal\"><span class=\"pre\">'reset'</span></tt> is found.  In\neach case the frame where it is set is included, unless you\nappend <tt class=\"docutils literal\"><span class=\"pre\">'_and_this'</span></tt> to the value (e.g.,\n<tt class=\"docutils literal\"><span class=\"pre\">'before_and_this'</span></tt>).</p>\n<p class=\"last\">Note that formatters will ignore this entirely if the frame\nthat contains the error wouldn&#8217;t normally be shown according\nto these rules.</p>\n</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__traceback_reporter__</span></tt>:</dt>\n<dd>This should be a reporter object (see the reporter module),\nor a list/tuple of reporter objects.  All reporters found this\nway will be given the exception, innermost first.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__traceback_decorator__</span></tt>:</dt>\n<dd>This object (defined in a local or global scope) will get the\nresult of this function (the CollectedException defined\nbelow).  It may modify this object in place, or return an\nentirely new object.  This gives the object the ability to\nmanipulate the traceback arbitrarily.</dd>\n</dl>\n<p>The actually interpretation of these values is largely up to the\nreporters and formatters.</p>\n<p><tt class=\"docutils literal\"><span class=\"pre\">collect_exception(*sys.exc_info())</span></tt> will return an object with\nseveral attributes:</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">frames</span></tt>:</dt>\n<dd>A list of frames</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">exception_formatted</span></tt>:</dt>\n<dd>The formatted exception, generally a full traceback</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">exception_type</span></tt>:</dt>\n<dd>The type of the exception, like <tt class=\"docutils literal\"><span class=\"pre\">ValueError</span></tt></dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">exception_value</span></tt>:</dt>\n<dd>The string value of the exception, like <tt class=\"docutils literal\"><span class=\"pre\">'x</span> <span class=\"pre\">not</span> <span class=\"pre\">in</span> <span class=\"pre\">list'</span></tt></dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">identification_code</span></tt>:</dt>\n<dd>A hash of the exception data meant to identify the general\nexception, so that it shares this code with other exceptions\nthat derive from the same problem.  The code is a hash of\nall the module names and function names in the traceback,\nplus exception_type.  This should be shown to users so they\ncan refer to the exception later. (&#64;&#64;: should it include a\nportion that allows identification of the specific instance\nof the exception as well?)</dd>\n</dl>\n<p>The list of frames goes innermost first.  Each frame has these\nattributes; some values may be None if they could not be\ndetermined.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">modname</span></tt>:</dt>\n<dd>the name of the module</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">filename</span></tt>:</dt>\n<dd>the filename of the module</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">lineno</span></tt>:</dt>\n<dd>the line of the error</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">revision</span></tt>:</dt>\n<dd>the contents of __version__ or __revision__</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">name</span></tt>:</dt>\n<dd>the function name</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">supplement</span></tt>:</dt>\n<dd>an object created from <tt class=\"docutils literal\"><span class=\"pre\">__traceback_supplement__</span></tt></dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">supplement_exception</span></tt>:</dt>\n<dd>a simple traceback of any exception <tt class=\"docutils literal\"><span class=\"pre\">__traceback_supplement__</span></tt>\ncreated</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">traceback_info</span></tt>:</dt>\n<dd>the str() of any <tt class=\"docutils literal\"><span class=\"pre\">__traceback_info__</span></tt> variable found in the local\nscope (&#64;&#64;: should it str()-ify it or not?)</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">traceback_hide</span></tt>:</dt>\n<dd>the value of any <tt class=\"docutils literal\"><span class=\"pre\">__traceback_hide__</span></tt> variable</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">traceback_log</span></tt>:</dt>\n<dd>the value of any <tt class=\"docutils literal\"><span class=\"pre\">__traceback_log__</span></tt> variable</dd>\n</dl>\n<p><tt class=\"docutils literal\"><span class=\"pre\">__traceback_supplement__</span></tt> is thrown away, but a fixed\nset of attributes are captured; each of these attributes is\noptional.</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">object</span></tt>:</dt>\n<dd>the name of the object being visited</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">source_url</span></tt>:</dt>\n<dd>the original URL requested</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">line</span></tt>:</dt>\n<dd>the line of source being executed (for interpreters, like ZPT)</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">column</span></tt>:</dt>\n<dd>the column of source being executed</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">expression</span></tt>:</dt>\n<dd>the expression being evaluated (also for interpreters)</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">warnings</span></tt>:</dt>\n<dd>a list of (string) warnings to be displayed</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">getInfo</span></tt>:</dt>\n<dd>a function/method that takes no arguments, and returns a string\ndescribing any extra information</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">extraData</span></tt>:</dt>\n<dd>a function/method that takes no arguments, and returns a\ndictionary.  The contents of this dictionary will not be\ndisplayed in the context of the traceback, but globally for\nthe exception.  Results will be grouped by the keys in the\ndictionaries (which also serve as titles).  The keys can also\nbe tuples of (importance, title); in this case the importance\nshould be <tt class=\"docutils literal\"><span class=\"pre\">important</span></tt> (shows up at top), <tt class=\"docutils literal\"><span class=\"pre\">normal</span></tt> (shows\nup somewhere; unspecified), <tt class=\"docutils literal\"><span class=\"pre\">supplemental</span></tt> (shows up at\nbottom), or <tt class=\"docutils literal\"><span class=\"pre\">extra</span></tt> (shows up hidden or not at all).</dd>\n</dl>\n<p>These are used to create an object with attributes of the same\nnames (<tt class=\"docutils literal\"><span class=\"pre\">getInfo</span></tt> becomes a string attribute, not a method).\n<tt class=\"docutils literal\"><span class=\"pre\">__traceback_supplement__</span></tt> implementations should be careful to\nproduce values that are relatively static and unlikely to cause\nfurther errors in the reporting system &#8211; any complex\nintrospection should go in <tt class=\"docutils literal\"><span class=\"pre\">getInfo()</span></tt> and should ultimately\nreturn a string.</p>\n<p>Note that all attributes are optional, and under certain\ncircumstances may be None or may not exist at all &#8211; the collector\ncan only do a best effort, but must avoid creating any exceptions\nitself.</p>\n<p>Formatters may want to use <tt class=\"docutils literal\"><span class=\"pre\">__traceback_hide__</span></tt> as a hint to\nhide frames that are part of the &#8216;framework&#8217; or underlying system.\nThere are a variety of rules about special values for this\nvariables that formatters should be aware of.</p>\n<p>TODO:</p>\n<p>More attributes in __traceback_supplement__?  Maybe an attribute\nthat gives a list of local variables that should also be\ncollected?  Also, attributes that would be explicitly meant for\nthe entire request, not just a single frame.  Right now some of\nthe fixed set of attributes (e.g., source_url) are meant for this\nuse, but there&#8217;s no explicit way for the supplement to indicate\nnew values, e.g., logged-in user, HTTP referrer, environment, etc.\nAlso, the attributes that do exist are Zope/Web oriented.</p>\n<p>More information on frames?  cgitb, for instance, produces\nextensive information on local variables.  There exists the\npossibility that getting this information may cause side effects,\nwhich can make debugging more difficult; but it also provides\nfodder for post-mortem debugging.  However, the collector is not\nmeant to be configurable, but to capture everything it can and let\nthe formatters be configurable.  Maybe this would have to be a\nconfiguration value, or maybe it could be indicated by another\nmagical variable (which would probably mean &#8216;show all local\nvariables below this frame&#8217;)</p>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"weberror.collector.ExceptionFrame\">\n<!--[weberror.collector.ExceptionFrame]-->class <tt class=\"descclassname\">weberror.collector.</tt><tt class=\"descname\">ExceptionFrame</tt><big>(</big><em>**attrs</em><big>)</big><a class=\"headerlink\" href=\"#weberror.collector.ExceptionFrame\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>This represents one frame of the exception.  Each frame is a\ncontext in the call stack, typically represented by a line\nnumber and module name in the traceback.</p>\n<dl class=\"method\">\n<dt id=\"weberror.collector.ExceptionFrame.get_source_line\">\n<!--[weberror.collector.ExceptionFrame.get_source_line]--><tt class=\"descname\">get_source_line</tt><big>(</big><em>context=0</em><big>)</big><a class=\"headerlink\" href=\"#weberror.collector.ExceptionFrame.get_source_line\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return the source of the current line of this frame.  You\nprobably want to .strip() it as well, as it is likely to have\nleading whitespace.</p>\n<p>If context is given, then that many lines on either side will\nalso be returned.  E.g., context=1 will give 3 lines.</p>\n</dd></dl>\n\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"weberror.collector.collect_exception\">\n<!--[weberror.collector.collect_exception]--><tt class=\"descclassname\">weberror.collector.</tt><tt class=\"descname\">collect_exception</tt><big>(</big><em>t</em>, <em>v</em>, <em>tb</em>, <em>limit=None</em><big>)</big><a class=\"headerlink\" href=\"#weberror.collector.collect_exception\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Collection an exception from <tt class=\"docutils literal\"><span class=\"pre\">sys.exc_info()</span></tt>.</p>\n<p>Use like:</p>\n<pre>try:\n    blah blah\nexcept:\n    exc_data = collect_exception(*sys.exc_info())</pre>\n</dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "thirdparty/weberror", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 3fefb1f90316b029b7937c01964e4fd8
-ETag: 2346907597
+ETag: 2905608934
 
 {
   "_id": "3fefb1f90316b029b7937c01964e4fd8", 
-  "_rev": "2346907597", 
+  "_rev": "2905608934", 
   "blog": null, 
   "created": "2008-10-01T19:40:25Z", 
   "last_login": "2008-10-01T19:40:25Z", 
   "type": "Human", 
   "username": "fsmith"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 42030ca2650c332be73138b7ebf749ee
-ETag: 3176553684
+ETag: 3581650868
 
 {
   "_id": "42030ca2650c332be73138b7ebf749ee", 
-  "_rev": "3176553684", 
+  "_rev": "3581650868", 
   "body": "<div class=\"section\" id=\"id1\">\n<span id=\"helpers\"></span><h1>Helpers<a class=\"headerlink\" href=\"#id1\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<p>Helpers are functions intended for usage in templates, to assist with common\nHTML and text manipulation, higher level constructs like a HTML\ntag builder (that safely escapes variables), and advanced functionality\nlike Pagination of data sets.</p>\n<p>The majority of the helpers available in Pylons are provided by the\n<a title=\"\" class=\"reference external\" href=\"../thirdparty/webhelpers/\"><tt class=\"xref docutils literal\"><span class=\"pre\">webhelpers</span></tt></a> package. Some of these helpers are also used in controllers\nto prepare data for use in the template by other helpers, such as the\n<tt class=\"xref docutils literal\"><span class=\"pre\">secure_form_tag()</span></tt> function which has a corresponding\n<a title=\"pylons.decorators.secure.authenticate_form\" class=\"reference external\" href=\"../modules/decorators_secure/#pylons.decorators.secure.authenticate_form\"><tt class=\"xref docutils literal\"><span class=\"pre\">authenticate_form()</span></tt></a>.</p>\n<p>To make individual helpers available for use in templates under <a class=\"reference external\" href=\"../glossary/#term-h\"><em class=\"xref\">h</em></a>, the\nappropriate functions need to be imported in <tt class=\"docutils literal\"><span class=\"pre\">lib/helpers.py</span></tt>. All the\nfunctions available in this file are then available under <a class=\"reference external\" href=\"../glossary/#term-h\"><em class=\"xref\">h</em></a> just like\nany other module reference.</p>\n<p>By customizing the <tt class=\"docutils literal\"><span class=\"pre\">lib/helpers.py</span></tt> module you can quickly add custom\nfunctions and classes for use in your templates.</p>\n<p>Helper functions are organized into modules by theme. All HTML generators are under the <tt class=\"docutils literal\"><span class=\"pre\">webhelpers_html</span></tt> package, except for a few third-party modules which are directly under <tt class=\"docutils literal\"><span class=\"pre\">webhelpers</span></tt>. The webhelpers modules are separately documented, see <a title=\"\" class=\"reference external\" href=\"../thirdparty/webhelpers/\"><tt class=\"xref docutils literal\"><span class=\"pre\">webhelpers</span></tt></a>.</p>\n<div class=\"section\" id=\"id2\">\n<span id=\"pagination\"></span><h2>Pagination<a class=\"headerlink\" href=\"#id2\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">The <cite>paginate</cite> module is not compatible to the deprecated <cite>pagination</cite>\nmodule that was provided with former versions of the Webhelpers package.</p>\n</div>\n<div class=\"section\" id=\"purpose-of-a-paginator\">\n<h3>Purpose of a paginator<a class=\"headerlink\" href=\"#purpose-of-a-paginator\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>When you display large amounts of data like a result from an SQL query then\nusually you cannot display all the results on a single page. It would simply be\ntoo much. So you divide the data into smaller chunks. This is what a paginator\ndoes. It shows one page of chunk of data at a time. Imagine you are providing a\ncompany phonebook through the web and let the user search the entries. Assume\nthe search result contains 23 entries. You may decide to display no more than 10\nentries per page. The first page contains entries 1-10, the second 11-20 and the\nthird 21-23. And you also show a navigational element like\n<tt class=\"docutils literal\"><span class=\"pre\">Page</span> <span class=\"pre\">1</span> <span class=\"pre\">of</span> <span class=\"pre\">3:</span> <span class=\"pre\">[1]</span> <span class=\"pre\">2</span> <span class=\"pre\">3</span></tt> that allows the user to switch between the available\npages.</p>\n</div>\n<div class=\"section\" id=\"the-page-class\">\n<h3>The <tt class=\"docutils literal\"><span class=\"pre\">Page</span></tt> class<a class=\"headerlink\" href=\"#the-page-class\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>The <a title=\"\" class=\"reference external\" href=\"../thirdparty/webhelpers/\"><tt class=\"xref docutils literal\"><span class=\"pre\">webhelpers</span></tt></a> package provides a <em>paginate</em> module that can be used\nfor this purpose. It can create pages from simple Python lists as well as\nSQLAlchemy queries and SQLAlchemy select objects. The module provides a <tt class=\"docutils literal\"><span class=\"pre\">Page</span></tt>\nobject that represents a single page of items from a larger result set. Such a\n<tt class=\"docutils literal\"><span class=\"pre\">Page</span></tt> mainly behaves like a list of items on that page. Let&#8217;s take the above\nexample of 23 items spread across 3 pages:</p>\n<pre># Create a list of items from 1 to 23\n&gt;&gt;&gt; items = range(1,24)\n\n# Import the paginate module\n&gt;&gt;&gt; import webhelpers.paginate\n\n# Create a Page object from the 'items' for the second page\n&gt;&gt;&gt; page2 = webhelpers.paginate.Page(items, page=2, items_per_page=10)\n\n# The Page object can be printed (__repr__) to show details on the page\n&gt;&gt;&gt; page2\n\n    Page:\n    Collection type:  &lt;type 'list'&gt;\n    (Current) page:   2\n    First item:       11\n    Last item:        20\n    First page:       1\n    Last page:        3\n    Previous page:    1\n    Next page:        3\n    Items per page:   10\n    Number of items:  23\n    Number of pages:  3\n\n# Show the items on this page\n&gt;&gt;&gt; list(page2)\n\n    [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n\n# Print the items in a for loop\n&gt;&gt;&gt; for i in page2: print \"This is entry\", i\n\n    This is entry 11\n    This is entry 12\n    This is entry 13\n    This is entry 14\n    This is entry 15\n    This is entry 16\n    This is entry 17\n    This is entry 18\n    This is entry 19\n    This is entry 20</pre>\n<p>There are further parameters to invoking a <tt class=\"docutils literal\"><span class=\"pre\">Page</span></tt> object. Please see\n<a title=\"webhelpers.paginate.Page\" class=\"reference external\" href=\"../thirdparty/webhelpers/paginate/#webhelpers.paginate.Page\"><tt class=\"xref docutils literal\"><span class=\"pre\">webhelpers.paginate.Page</span></tt></a></p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Page numbers and item numbers start from 1. If you are accessing the\nitems on the page by their index please note that the first item is\n<tt class=\"docutils literal\"><span class=\"pre\">item[1]</span></tt> instead of <tt class=\"docutils literal\"><span class=\"pre\">item[0]</span></tt>.</p>\n</div>\n</div>\n<div class=\"section\" id=\"switching-between-pages-using-a-pager\">\n<h3>Switching between pages using a <cite>pager</cite><a class=\"headerlink\" href=\"#switching-between-pages-using-a-pager\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>The user needs a way to get to another page. This is usually done with a list\nof links like <tt class=\"docutils literal\"><span class=\"pre\">Page</span> <span class=\"pre\">3</span> <span class=\"pre\">of</span> <span class=\"pre\">41</span> <span class=\"pre\">-</span> <span class=\"pre\">1</span> <span class=\"pre\">2</span> <span class=\"pre\">[3]</span> <span class=\"pre\">4</span> <span class=\"pre\">5</span> <span class=\"pre\">..</span> <span class=\"pre\">41</span></tt>. Such a list can be\ncreated by the Page&#8217;s <a title=\"webhelpers.paginate.Page.pager\" class=\"reference external\" href=\"../thirdparty/webhelpers/paginate/#webhelpers.paginate.Page.pager\"><tt class=\"xref docutils literal\"><span class=\"pre\">pager()</span></tt></a> method.\nTake the above example again:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">page2</span><span class=\"o\">.</span><span class=\"n\">pager</span><span class=\"p\">()</span>\n\n<span class=\"go\">    &lt;a class=&quot;pager_link&quot; href=&quot;/content?page=1&quot;&gt;1&lt;/a&gt;</span>\n<span class=\"go\">    &lt;span class=&quot;pager_curpage&quot;&gt;2&lt;/span&gt;</span>\n<span class=\"go\">    &lt;a class=&quot;pager_link&quot; href=&quot;/content?page=3&quot;&gt;3&lt;/a&gt;</span>\n</pre></div>\n<p>Without the HTML tags it looks like <tt class=\"docutils literal\"><span class=\"pre\">1</span> <span class=\"pre\">[2]</span> <span class=\"pre\">3</span></tt>. The links point to a URL\nwhere the respective page is found. And the current page (2) is highlighted.</p>\n<p>The appearance of a pager can be customized. By default the format string\nis <tt class=\"docutils literal\"><span class=\"pre\">~2~</span></tt> which means it shows adjacent pages from the current page with\na maximal radius of 2. In a larger set this would look like\n<tt class=\"docutils literal\"><span class=\"pre\">1</span> <span class=\"pre\">..</span> <span class=\"pre\">34</span> <span class=\"pre\">35</span> <span class=\"pre\">[36]</span> <span class=\"pre\">37</span> <span class=\"pre\">38</span> <span class=\"pre\">..</span> <span class=\"pre\">176</span></tt>. The radius of 2 means that two pages before\nand after the current page 36 are shown.</p>\n<p>Several special variables can be used in the format string. See\n<a title=\"webhelpers.paginate.Page.pager\" class=\"reference external\" href=\"../thirdparty/webhelpers/paginate/#webhelpers.paginate.Page.pager\"><tt class=\"xref docutils literal\"><span class=\"pre\">pager()</span></tt></a> for a complete list. Some examples\nfor a pager of 20 pages while being on page 10 currently:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">page</span><span class=\"o\">.</span><span class=\"n\">pager</span><span class=\"p\">()</span>\n\n<span class=\"go\">    1 .. 8 9 [10] 11 12 .. 20</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">page</span><span class=\"o\">.</span><span class=\"n\">pager</span><span class=\"p\">(</span><span class=\"s\">&#39;~4~&#39;</span><span class=\"p\">)</span>\n\n<span class=\"go\">    1 .. 6 7 8 9 [10] 11 12 13 14 .. 20</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">page</span><span class=\"o\">.</span><span class=\"n\">pager</span><span class=\"p\">(</span><span class=\"s\">&#39;Page $page of $page_count - ~3~&#39;</span><span class=\"p\">)</span>\n\n<span class=\"go\">    Page 10 of 20 - 1 .. 7 8 9 [10] 11 12 13 .. 20</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">page</span><span class=\"o\">.</span><span class=\"n\">pager</span><span class=\"p\">(</span><span class=\"s\">&#39;$link_previous $link_next ~2~&#39;</span><span class=\"p\">)</span>\n\n<span class=\"go\">    &lt; &gt; 1 .. 8 9 [10] 11 12 .. 20</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">page</span><span class=\"o\">.</span><span class=\"n\">pager</span><span class=\"p\">(</span><span class=\"s\">&#39;Items $first_item - $last_item / ~2~&#39;</span><span class=\"p\">)</span>\n\n<span class=\"go\">    Items 91 - 100 / 1 .. 8 9 [10] 11 12 .. 20</span>\n</pre></div>\n</div>\n<div class=\"section\" id=\"paging-over-an-sqlalchemy-query\">\n<h3>Paging over an SQLAlchemy query<a class=\"headerlink\" href=\"#paging-over-an-sqlalchemy-query\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>If the data to page over comes from a database via SQLAlchemy then the\n<tt class=\"docutils literal\"><span class=\"pre\">paginate</span></tt> module can access a <tt class=\"docutils literal\"><span class=\"pre\">query</span></tt> object directly. This is useful\nwhen using ORM-mapped models. Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">employee_query</span> <span class=\"o\">=</span> <span class=\"n\">Session</span><span class=\"o\">.</span><span class=\"n\">query</span><span class=\"p\">(</span><span class=\"n\">Employee</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">page2</span> <span class=\"o\">=</span> <span class=\"n\">webhelpers</span><span class=\"o\">.</span><span class=\"n\">paginate</span><span class=\"o\">.</span><span class=\"n\">Page</span><span class=\"p\">(</span>\n<span class=\"go\">        employee_query,</span>\n<span class=\"go\">        page=2,</span>\n<span class=\"go\">        items_per_page=10)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">for</span> <span class=\"n\">employee</span> <span class=\"ow\">in</span> <span class=\"n\">page2</span><span class=\"p\">:</span> <span class=\"k\">print</span> <span class=\"n\">employee</span><span class=\"o\">.</span><span class=\"n\">first_name</span>\n\n<span class=\"go\">    John</span>\n<span class=\"go\">    Jack</span>\n<span class=\"go\">    Joseph</span>\n<span class=\"go\">    Kay</span>\n<span class=\"go\">    Lars</span>\n<span class=\"go\">    Lynn</span>\n<span class=\"go\">    Pamela</span>\n<span class=\"go\">    Sandra</span>\n<span class=\"go\">    Thomas</span>\n<span class=\"go\">    Tim</span>\n</pre></div>\n<p>The <cite>paginate</cite> module is smart enough to only query the database for the\nobjets that are needed on this page. E.g. if a page consists of the items\n11-20 then SQLAlchemy will be asked to fetch exactly that 10 rows\nthrough <cite>LIMIT</cite> and <cite>OFFSET</cite> in the actual SQL query. So you must not load\nthe complete result set into memory and pass that. Instead always pass\na <cite>query</cite> when creating a <cite>Page</cite>.</p>\n</div>\n<div class=\"section\" id=\"paging-over-an-sqlalchemy-select\">\n<h3>Paging over an SQLAlchemy select<a class=\"headerlink\" href=\"#paging-over-an-sqlalchemy-select\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>SQLAlchemy also allows to run arbitrary SELECTs on database tables.\nThis is useful for non-ORM queries. <cite>paginate</cite> can use such select\nobjects, too. Example:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">selection</span> <span class=\"o\">=</span> <span class=\"n\">sqlalchemy</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">([</span><span class=\"n\">Employee</span><span class=\"o\">.</span><span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">first_name</span><span class=\"p\">])</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">page2</span> <span class=\"o\">=</span> <span class=\"n\">webhelpers</span><span class=\"o\">.</span><span class=\"n\">paginate</span><span class=\"o\">.</span><span class=\"n\">Page</span><span class=\"p\">(</span>\n<span class=\"go\">        selection,</span>\n<span class=\"go\">        page=2,</span>\n<span class=\"go\">        items_per_page=10,</span>\n<span class=\"go\">        sqlalchemy_session=model.Session)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">for</span> <span class=\"n\">first_name</span> <span class=\"ow\">in</span> <span class=\"n\">page2</span><span class=\"p\">:</span> <span class=\"k\">print</span> <span class=\"n\">first_name</span>\n\n<span class=\"go\">    John</span>\n<span class=\"go\">    Jack</span>\n<span class=\"go\">    Joseph</span>\n<span class=\"go\">    Kay</span>\n<span class=\"go\">    Lars</span>\n<span class=\"go\">    Lynn</span>\n<span class=\"go\">    Pamela</span>\n<span class=\"go\">    Sandra</span>\n<span class=\"go\">    Thomas</span>\n<span class=\"go\">    Tim</span>\n</pre></div>\n<p>The only difference to using SQLAlchemy <em>query</em> objects is that you need to\npass an SQLAlchemy <em>session</em> via the <tt class=\"docutils literal\"><span class=\"pre\">sqlalchemy_session</span></tt> parameter.\nA bare <tt class=\"docutils literal\"><span class=\"pre\">select</span></tt> does not have a database connection assigned. But the session\nhas.</p>\n</div>\n<div class=\"section\" id=\"usage-in-a-pylons-controller-and-template\">\n<h3>Usage in a Pylons controller and template<a class=\"headerlink\" href=\"#usage-in-a-pylons-controller-and-template\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>A simple example to begin with.</p>\n<p>Controller:</p>\n<div class=\"highlight\"><pre><span class=\"k\">def</span> <span class=\"nf\">list</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n    <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">employees</span> <span class=\"o\">=</span> <span class=\"n\">webhelpers</span><span class=\"o\">.</span><span class=\"n\">paginate</span><span class=\"o\">.</span><span class=\"n\">Page</span><span class=\"p\">(</span>\n        <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">Session</span><span class=\"o\">.</span><span class=\"n\">query</span><span class=\"p\">(</span><span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">Employee</span><span class=\"p\">),</span>\n        <span class=\"n\">page</span> <span class=\"o\">=</span> <span class=\"nb\">int</span><span class=\"p\">(</span><span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;page&#39;</span><span class=\"p\">]),</span>\n        <span class=\"n\">items_per_page</span> <span class=\"o\">=</span> <span class=\"mf\">5</span>\n        <span class=\"p\">)</span>\n    <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/employees/list.mako&#39;</span><span class=\"p\">)</span>\n</pre></div>\n<p>Template:</p>\n<div class=\"highlight\"><pre><span class=\"cp\">${</span> <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">employees</span><span class=\"o\">.</span><span class=\"n\">pager</span><span class=\"p\">(</span><span class=\"s\">&#39;Page $page: $link_previous $link_next ~4~&#39;</span><span class=\"p\">)</span> <span class=\"cp\">}</span><span class=\"x\"></span>\n<span class=\"x\">&lt;ul&gt;</span>\n<span class=\"cp\">%</span> <span class=\"k\">for</span> <span class=\"n\">employee</span> <span class=\"ow\">in</span> <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">employees</span><span class=\"p\">:</span><span class=\"x\"></span>\n<span class=\"x\">    &lt;li&gt;</span><span class=\"cp\">${</span> <span class=\"n\">employee</span><span class=\"o\">.</span><span class=\"n\">first_name</span> <span class=\"cp\">}</span><span class=\"x\"> </span><span class=\"cp\">${</span> <span class=\"n\">employee</span><span class=\"o\">.</span><span class=\"n\">last_name</span><span class=\"cp\">}</span><span class=\"x\">&lt;/li&gt;</span>\n<span class=\"cp\">%</span><span class=\"k\"> endfor</span><span class=\"x\"></span>\n<span class=\"x\">&lt;/ul&gt;</span>\n</pre></div>\n<p>The <cite>pager()</cite> creates links to the previous URL and just sets the\n<em>page</em> parameter appropriately. That&#8217;s why you need to pass the requested page\nnumber (<tt class=\"docutils literal\"><span class=\"pre\">request.params['page']</span></tt>) when you create a <cite>Page</cite>.</p>\n</div>\n<div class=\"section\" id=\"partial-updates-with-ajax\">\n<h3>Partial updates with AJAX<a class=\"headerlink\" href=\"#partial-updates-with-ajax\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Updating a page partially is easy. All it takes is a little Javascript\nthat - instead of loading the complete page - updates just the part\nof the page containing the paginated items. The <tt class=\"docutils literal\"><span class=\"pre\">render()</span></tt> method accepts an\n<tt class=\"docutils literal\"><span class=\"pre\">onclick</span></tt> parameter for that purpose. This value is added as an <tt class=\"docutils literal\"><span class=\"pre\">onclick</span></tt>\nparameter to the A-HREF tags. So the <tt class=\"docutils literal\"><span class=\"pre\">href</span></tt> parameter points to a URL\nthat loads the complete page while the <tt class=\"docutils literal\"><span class=\"pre\">onclick</span></tt> parameter provides Javascript\nthat loads a partial page. An example (using the jQuery Javascript library for\nsimplification) may help explain that.</p>\n<p>Controller:</p>\n<div class=\"highlight\"><pre><span class=\"k\">def</span> <span class=\"nf\">list</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n    <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">employees</span> <span class=\"o\">=</span> <span class=\"n\">webhelpers</span><span class=\"o\">.</span><span class=\"n\">paginate</span><span class=\"o\">.</span><span class=\"n\">Page</span><span class=\"p\">(</span>\n        <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">Session</span><span class=\"o\">.</span><span class=\"n\">query</span><span class=\"p\">(</span><span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">Employee</span><span class=\"p\">),</span>\n        <span class=\"n\">page</span> <span class=\"o\">=</span> <span class=\"nb\">int</span><span class=\"p\">(</span><span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;page&#39;</span><span class=\"p\">]),</span>\n        <span class=\"n\">items_per_page</span> <span class=\"o\">=</span> <span class=\"mf\">5</span>\n        <span class=\"p\">)</span>\n    <span class=\"k\">if</span> <span class=\"s\">&#39;partial&#39;</span> <span class=\"ow\">in</span> <span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">params</span><span class=\"p\">:</span>\n        <span class=\"c\"># Render the partial page</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/employees/list-partial.mako&#39;</span><span class=\"p\">)</span>\n    <span class=\"k\">else</span><span class=\"p\">:</span>\n        <span class=\"c\"># Render the full page</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/employees/list-full.mako&#39;</span><span class=\"p\">)</span>\n</pre></div>\n<p>Template <tt class=\"docutils literal\"><span class=\"pre\">list-full.mako</span></tt>:</p>\n<div class=\"highlight\"><pre><span class=\"x\">&lt;html&gt;</span>\n<span class=\"x\">    &lt;head&gt;</span>\n<span class=\"x\">        </span><span class=\"cp\">${</span> <span class=\"n\">webhelpers</span><span class=\"o\">.</span><span class=\"n\">html</span><span class=\"o\">.</span><span class=\"n\">tags</span><span class=\"o\">.</span><span class=\"n\">javascript_link</span><span class=\"p\">(</span><span class=\"s\">&#39;/public/jQuery.js&#39;</span><span class=\"p\">)</span> <span class=\"cp\">}</span><span class=\"x\"></span>\n<span class=\"x\">    &lt;/head&gt;</span>\n<span class=\"x\">    &lt;body&gt;</span>\n<span class=\"x\">        &lt;div id=&quot;page-area&quot;&gt;</span>\n<span class=\"x\">            </span><span class=\"cp\">&lt;%</span><span class=\"nb\">include</span> <span class=\"na\">file=</span><span class=\"s\">&quot;list-partial.mako&quot;</span><span class=\"cp\">/&gt;</span><span class=\"x\"></span>\n<span class=\"x\">        &lt;/div&gt;</span>\n<span class=\"x\">    &lt;/body&gt;</span>\n<span class=\"x\">&lt;/html&gt;</span>\n</pre></div>\n<p>Template <tt class=\"docutils literal\"><span class=\"pre\">list-partial.mako</span></tt>:</p>\n<div class=\"highlight\"><pre><span class=\"cp\">${</span> <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">employees</span><span class=\"o\">.</span><span class=\"n\">pager</span><span class=\"p\">(</span>\n    <span class=\"s\">&#39;Page $page: $link_previous $link_next ~4~&#39;</span><span class=\"p\">,</span>\n    <span class=\"n\">onclick</span><span class=\"o\">=</span><span class=\"s\">&quot;$(&#39;#my-page-area&#39;).load(&#39;</span><span class=\"si\">%s</span><span class=\"s\">&#39;); return false;&quot;</span>\n    <span class=\"p\">)</span> <span class=\"cp\">}</span><span class=\"x\"></span>\n<span class=\"x\">&lt;ul&gt;</span>\n<span class=\"cp\">%</span> <span class=\"k\">for</span> <span class=\"n\">employee</span> <span class=\"ow\">in</span> <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">employees</span><span class=\"p\">:</span><span class=\"x\"></span>\n<span class=\"x\">    &lt;li&gt;</span><span class=\"cp\">${</span> <span class=\"n\">employee</span><span class=\"o\">.</span><span class=\"n\">first_name</span> <span class=\"cp\">}</span><span class=\"x\"> </span><span class=\"cp\">${</span> <span class=\"n\">employee</span><span class=\"o\">.</span><span class=\"n\">last_name</span><span class=\"cp\">}</span><span class=\"x\">&lt;/li&gt;</span>\n<span class=\"cp\">%</span><span class=\"k\"> endfor</span><span class=\"x\"></span>\n<span class=\"x\">&lt;/ul&gt;</span>\n</pre></div>\n<p>To avoid code duplication in the template the full template includes the partial\ntemplate. If a partial page load is requested then just the\n<tt class=\"docutils literal\"><span class=\"pre\">list-partial.mako</span></tt> gets rendered. And if a full page load is requested then\nthe <tt class=\"docutils literal\"><span class=\"pre\">list-full.mako</span></tt> is rendered which in turn includes the\n<tt class=\"docutils literal\"><span class=\"pre\">list-partial.mako</span></tt>.</p>\n<p>The <tt class=\"docutils literal\"><span class=\"pre\">%s</span></tt> variable in the <tt class=\"docutils literal\"><span class=\"pre\">onclick</span></tt> string gets replaced with a URL pointing\nto the respective page with a <tt class=\"docutils literal\"><span class=\"pre\">partial=1</span></tt> added (the name of the parameter can be customized through the <tt class=\"docutils literal\"><span class=\"pre\">partial_param</span></tt> parameter). Example:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\"><span class=\"pre\">href</span></tt> parameter points to <tt class=\"docutils literal\"><span class=\"pre\">/employees/list?page=3</span></tt></li>\n<li><tt class=\"docutils literal\"><span class=\"pre\">onclick</span></tt> parameter contains Javascript loading\n<tt class=\"docutils literal\"><span class=\"pre\">/employees/list?page=3&amp;partial=1</span></tt></li>\n</ul>\n<p>jQuery&#8217;s syntax to load a URL into a certain DOM object (e.g. a DIV) is simply:</p>\n<pre>$('#some-id').load('/the/url')</pre>\n<p>The advantage of this technique is that it degrades gracefully. If the user does\nnot have Javascript enabled then a full page is loaded. And if Javascript works\nthen a partial load is done through the <tt class=\"docutils literal\"><span class=\"pre\">onclick</span></tt> action.</p>\n</div>\n</div>\n<div class=\"section\" id=\"secure-form-tag-helpers\">\n<span id=\"secure-forms\"></span><h2>Secure Form Tag Helpers<a class=\"headerlink\" href=\"#secure-form-tag-helpers\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>For prevention of Cross-site request forgery (CSRF) attacks.</p>\n<p>Generates form tags that include client-specific authorization tokens to be\nverified by the destined web app.</p>\n<p>Authorization tokens are stored in the client&#8217;s session. The web app can then\nverify the request&#8217;s submitted authorization token with the value in the\nclient&#8217;s session.</p>\n<p>This ensures the request came from the originating page. See the wikipedia entry\nfor <a class=\"reference external\" href=\"http://en.wikipedia.org/wiki/Cross-site_request_forgery\">Cross-site request forgery</a> for more information.</p>\n<p>Pylons provides an <tt class=\"docutils literal\"><span class=\"pre\">authenticate_form</span></tt> decorator that does this verfication\non the behalf of controllers.</p>\n<p>These helpers depend on Pylons&#8217; <tt class=\"docutils literal\"><span class=\"pre\">session</span></tt> object.  Most of them can be easily\nported to another framework by changing the API calls.</p>\n<p>The helpers are implemented in such a way that it should be easy for developers\nto create their own helpers if using helpers for AJAX calls.</p>\n<p><tt class=\"xref docutils literal\"><span class=\"pre\">authentication_token()</span></tt> returns the current authentication token, creating one\nand storing it in the session if it doesn&#8217;t already exist.</p>\n<p><tt class=\"xref docutils literal\"><span class=\"pre\">auth_token_hidden_field()</span></tt> creates a hidden field containing the authentication token.</p>\n<p><tt class=\"xref docutils literal\"><span class=\"pre\">secure_form()</span></tt> is <tt class=\"xref docutils literal\"><span class=\"pre\">form()</span></tt> plus <tt class=\"xref docutils literal\"><span class=\"pre\">auth_token_hidden_field()</span></tt>.</p>\n</div>\n</div>\n", 
   "current_page_name": "helpers", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 439db729c002856f947320e29bfb8271
-ETag: 3639684583
+ETag: 3297673995
 
 {
   "_id": "439db729c002856f947320e29bfb8271", 
-  "_rev": "3639684583", 
+  "_rev": "3297673995", 
   "body": "<div class=\"section\" id=\"webhelpers-commands-compress-resources-deprecated\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">webhelpers.commands.compress_resources</span></tt> &#8211; <em>(deprecated)</em><a class=\"headerlink\" href=\"#webhelpers-commands-compress-resources-deprecated\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">DEPRECATED!! BUGGY!! Do not use in new projects.</p>\n</div>\n<dl class=\"class\">\n<dt id=\"webhelpers.commands.compress_resources.compress_resources\">\n<!--[webhelpers.commands.compress_resources.compress_resources]-->class <tt class=\"descclassname\">webhelpers.commands.compress_resources.</tt><tt class=\"descname\">compress_resources</tt><big>(</big><em>dist</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.commands.compress_resources.compress_resources\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd></dd></dl>\n\n</div>\n", 
   "current_page_name": "thirdparty/webhelpers/commands/commands", 
   "display_toc": false, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 49b4a49214c67f89b5d1ee79a70c1493
-ETag: 2624687320
+ETag: 535161584
 
 {
   "_id": "49b4a49214c67f89b5d1ee79a70c1493", 
-  "_rev": "2624687320", 
+  "_rev": "535161584", 
   "body": "<div class=\"section\" id=\"module-pylons.middleware\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">pylons.middleware</span></tt> &#8211; WSGI Middleware<a class=\"headerlink\" href=\"#module-pylons.middleware\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<p>Pylons&#8217; WSGI middlewares</p>\n<div class=\"section\" id=\"module-contents\">\n<h2>Module Contents<a class=\"headerlink\" href=\"#module-contents\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"class\">\n<dt id=\"pylons.middleware.StatusCodeRedirect\">\n<!--[pylons.middleware.StatusCodeRedirect]-->class <tt class=\"descclassname\">pylons.middleware.</tt><tt class=\"descname\">StatusCodeRedirect</tt><big>(</big><em>app</em>, <em>errors=(400</em>, <em>401</em>, <em>403</em>, <em>404)</em>, <em>path='/error/document'</em><big>)</big><a class=\"headerlink\" href=\"#pylons.middleware.StatusCodeRedirect\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Internally redirects a request based on status code</p>\n<p>StatusCodeRedirect watches the response of the app it wraps. If the \nresponse is an error code in the errors sequence passed the request\nwill be re-run with the path URL set to the path passed in.</p>\n<p>This operation is non-recursive and the output of the second \nrequest will be used no matter what it is.</p>\n<p>Should an application wish to bypass the error response (ie, to \npurposely return a 401), set \n<tt class=\"docutils literal\"><span class=\"pre\">environ['pylons.status_code_redirect']</span> <span class=\"pre\">=</span> <span class=\"pre\">True</span></tt> in the application.</p>\n<dl class=\"method\">\n<dt id=\"pylons.middleware.StatusCodeRedirect.__init__\">\n<!--[pylons.middleware.StatusCodeRedirect.__init__]--><tt class=\"descname\">__init__</tt><big>(</big><em>app</em>, <em>errors=(400</em>, <em>401</em>, <em>403</em>, <em>404)</em>, <em>path='/error/document'</em><big>)</big><a class=\"headerlink\" href=\"#pylons.middleware.StatusCodeRedirect.__init__\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Initialize the ErrorRedirect</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">errors</span></tt></dt>\n<dd>A sequence (list, tuple) of error code integers that should\nbe caught.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">path</span></tt></dt>\n<dd>The path to set for the next request down to the \napplication.</dd>\n</dl>\n</dd></dl>\n\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"pylons.middleware.StaticJavascripts\">\n<!--[pylons.middleware.StaticJavascripts]-->class <tt class=\"descclassname\">pylons.middleware.</tt><tt class=\"descname\">StaticJavascripts</tt><big>(</big><em>**kwargs</em><big>)</big><a class=\"headerlink\" href=\"#pylons.middleware.StaticJavascripts\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Middleware for intercepting requests for WebHelpers&#8217; included \njavascript files.</p>\n<p>Triggered when PATH_INFO begins with &#8216;/javascripts/&#8217;.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"pylons.middleware.ErrorHandler\">\n<!--[pylons.middleware.ErrorHandler]--><tt class=\"descclassname\">pylons.middleware.</tt><tt class=\"descname\">ErrorHandler</tt><big>(</big><em>app</em>, <em>global_conf</em>, <em>**errorware</em><big>)</big><a class=\"headerlink\" href=\"#pylons.middleware.ErrorHandler\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>ErrorHandler Toggle</p>\n<p>If debug is enabled, this function will return the app wrapped in\nthe WebError <tt class=\"docutils literal\"><span class=\"pre\">EvalException</span></tt> middleware which displays\ninteractive debugging sessions when a traceback occurs.</p>\n<p>Otherwise, the app will be wrapped in the WebError\n<tt class=\"docutils literal\"><span class=\"pre\">ErrorMiddleware</span></tt>, and the <tt class=\"docutils literal\"><span class=\"pre\">errorware</span></tt> dict will be passed into\nit. The <tt class=\"docutils literal\"><span class=\"pre\">ErrorMiddleware</span></tt> handles sending an email to the address\nlisted in the .ini file, under <tt class=\"docutils literal\"><span class=\"pre\">email_to</span></tt>.</p>\n</dd></dl>\n\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<dl class=\"last docutils\">\n<dt>The <tt class=\"xref docutils literal\"><span class=\"pre\">errorware</span></tt> dictionary is constructed from the settings in the <cite>DEFAULT</cite> section of development.ini. the recognised keys and settings at initialization are:</dt>\n<dd><ul class=\"first last simple\">\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">error_email</span></tt> = conf.get(&#8216;email_to&#8217;)</li>\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">error_log</span></tt> = conf.get(&#8216;error_log&#8217;, None)</li>\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">smtp_server</span></tt> = conf.get(&#8216;smtp_server&#8217;,&#8217;localhost&#8217;)</li>\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">error_subject_prefix</span></tt> = conf.get(&#8216;error_subject_prefix&#8217;, &#8216;WebApp Error: &#8216;)</li>\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">from_address</span></tt> = conf.get(&#8216;from_address&#8217;, conf.get(&#8216;error_email_from&#8217;, <a class=\"reference external\" href=\"mailto:'pylons&#37;&#52;&#48;yourapp&#46;com\">'pylons<span>&#64;</span>yourapp<span>&#46;</span>com</a>&#8216;))</li>\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">error_message</span></tt> = conf.get(&#8216;error_message&#8217;, &#8216;An internal server error occurred&#8217;)</li>\n</ul>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"section\" id=\"referenced-classes\">\n<h2>Referenced classes<a class=\"headerlink\" href=\"#referenced-classes\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Pylons middleware uses <tt class=\"xref docutils literal\"><span class=\"pre\">WebError</span></tt> to effect the error-handling. The two classes implicated are:</p>\n<div class=\"section\" id=\"errormiddleware\">\n<h3>ErrorMiddleware<a class=\"headerlink\" href=\"#errormiddleware\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p><a title=\"\" class=\"reference external\" href=\"../../thirdparty/weberror/#module-weberror.errormiddleware\"><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.errormiddleware</span></tt></a>\n<a title=\"weberror.errormiddleware.ErrorMiddleware\" class=\"reference external\" href=\"../../thirdparty/weberror/#weberror.errormiddleware.ErrorMiddleware\"><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.errormiddleware.ErrorMiddleware</span></tt></a></p>\n</div>\n<div class=\"section\" id=\"evalexception\">\n<h3>EvalException<a class=\"headerlink\" href=\"#evalexception\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p><a title=\"\" class=\"reference external\" href=\"../../thirdparty/weberror/#module-weberror.evalexception\"><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.evalexception</span></tt></a>\n<a title=\"weberror.evalexception.EvalException\" class=\"reference external\" href=\"../../thirdparty/weberror/#weberror.evalexception.EvalException\"><tt class=\"xref docutils literal\"><span class=\"pre\">weberror.evalexception.EvalException</span></tt></a></p>\n</div>\n</div>\n<div class=\"section\" id=\"legacy\">\n<h2>Legacy<a class=\"headerlink\" href=\"#legacy\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>\n<span class=\"versionmodified\">Changed in version 0.9.7: </span>These functions were deprecated in Pylons 0.9.7, and have been superceded\nby the <a title=\"pylons.middleware.StatusCodeRedirect\" class=\"reference internal\" href=\"#pylons.middleware.StatusCodeRedirect\"><tt class=\"xref docutils literal\"><span class=\"pre\">StatusCodeRedirect</span></tt></a> middleware.</p>\n<dl class=\"function\">\n<dt id=\"pylons.middleware.ErrorDocuments\">\n<!--[pylons.middleware.ErrorDocuments]--><tt class=\"descclassname\">pylons.middleware.</tt><tt class=\"descname\">ErrorDocuments</tt><big>(</big><em>app</em>, <em>global_conf=None</em>, <em>mapper=None</em>, <em>**kw</em><big>)</big><a class=\"headerlink\" href=\"#pylons.middleware.ErrorDocuments\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Wraps the app in error docs using Paste RecursiveMiddleware and\nErrorDocumentsMiddleware</p>\n<p>All the args are passed directly into the ErrorDocumentsMiddleware. If no\nmapper is given, a default error_mapper is passed in.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"pylons.middleware.error_mapper\">\n<!--[pylons.middleware.error_mapper]--><tt class=\"descclassname\">pylons.middleware.</tt><tt class=\"descname\">error_mapper</tt><big>(</big><em>code</em>, <em>message</em>, <em>environ</em>, <em>global_conf=None</em>, <em>**kw</em><big>)</big><a class=\"headerlink\" href=\"#pylons.middleware.error_mapper\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd>Legacy function used with ErrorDocuments to provide a mapping\nof error codes to handle</dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "modules/middleware", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 4d605ccb67d5f7b88adc8337d708756d
-ETag: 2669454661
+ETag: 3822750769
 
 {
   "_id": "4d605ccb67d5f7b88adc8337d708756d", 
-  "_rev": "2669454661", 
+  "_rev": "3822750769", 
   "body": "<div class=\"section\" id=\"misc-miscellaneous-helpers\">\n<h1><tt class=\"xref docutils literal\"><span class=\"pre\">misc</span></tt> &#8211; Miscellaneous helpers<a class=\"headerlink\" href=\"#misc-miscellaneous-helpers\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<div class=\"section\" id=\"webhelpers-misc\">\n<h2><tt class=\"xref docutils literal\"><span class=\"pre\">webhelpers.misc</span></tt><a class=\"headerlink\" href=\"#webhelpers-misc\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<dl class=\"function\">\n<dt id=\"webhelpers.misc.all\">\n<!--[webhelpers.misc.all]--><tt class=\"descclassname\">webhelpers.misc.</tt><tt class=\"descname\">all</tt><big>(</big><em>seq</em>, <em>pred=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.misc.all\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Is <tt class=\"docutils literal\"><span class=\"pre\">pred(elm)</span></tt> true for all elements?</p>\n<p>With the default predicate, this is the same as Python 2.5&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">all()</span></tt>\nfunction; i.e., it returns true if all elements are true.</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">all</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;B&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">True</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">all</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">False</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">all</span><span class=\"p\">([</span><span class=\"s\">&quot;&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">False</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">all</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;B&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">],</span> <span class=\"k\">lambda</span> <span class=\"n\">x</span><span class=\"p\">:</span> <span class=\"n\">x</span> <span class=\"o\">&lt;=</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">True</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">all</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;B&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">],</span> <span class=\"k\">lambda</span> <span class=\"n\">x</span><span class=\"p\">:</span> <span class=\"n\">x</span> <span class=\"o\">&lt;</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">False</span>\n</pre></div>\n<p>From recipe in itertools docs.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.misc.any\">\n<!--[webhelpers.misc.any]--><tt class=\"descclassname\">webhelpers.misc.</tt><tt class=\"descname\">any</tt><big>(</big><em>seq</em>, <em>pred=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.misc.any\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Is <tt class=\"docutils literal\"><span class=\"pre\">pred(elm)</span></tt> is true for any element?</p>\n<p>With the default predicate, this is the same as Python 2.5&#8217;s <tt class=\"docutils literal\"><span class=\"pre\">any()</span></tt>\nfunction; i.e., it returns true if any element is true.</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">any</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;B&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">True</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">any</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">True</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">any</span><span class=\"p\">([</span><span class=\"s\">&quot;&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">False</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">any</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;B&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">],</span> <span class=\"k\">lambda</span> <span class=\"n\">x</span><span class=\"p\">:</span> <span class=\"n\">x</span> <span class=\"o\">&lt;=</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">True</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">any</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;B&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">],</span> <span class=\"k\">lambda</span> <span class=\"n\">x</span><span class=\"p\">:</span> <span class=\"n\">x</span> <span class=\"o\">&lt;</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">True</span>\n</pre></div>\n<p>From recipe in itertools docs.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.misc.no\">\n<!--[webhelpers.misc.no]--><tt class=\"descclassname\">webhelpers.misc.</tt><tt class=\"descname\">no</tt><big>(</big><em>seq</em>, <em>pred=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.misc.no\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Is <tt class=\"docutils literal\"><span class=\"pre\">pred(elm)</span></tt> false for all elements?</p>\n<p>With the default predicate, this returns true if all elements are false.</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">no</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;B&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">False</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">no</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">False</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">no</span><span class=\"p\">([</span><span class=\"s\">&quot;&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">True</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">no</span><span class=\"p\">([</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;B&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">],</span> <span class=\"k\">lambda</span> <span class=\"n\">x</span><span class=\"p\">:</span> <span class=\"n\">x</span> <span class=\"o\">&lt;=</span> <span class=\"s\">&quot;C&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">False</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">no</span><span class=\"p\">([</span><span class=\"s\">&quot;X&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;Y&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;Z&quot;</span><span class=\"p\">],</span> <span class=\"k\">lambda</span> <span class=\"n\">x</span><span class=\"p\">:</span> <span class=\"n\">x</span> <span class=\"o\">&lt;=</span><span class=\"s\">&quot;C&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">True</span>\n</pre></div>\n<p>From recipe in itertools docs.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.misc.count_true\">\n<!--[webhelpers.misc.count_true]--><tt class=\"descclassname\">webhelpers.misc.</tt><tt class=\"descname\">count_true</tt><big>(</big><em>seq</em>, <em>pred=&lt;function &lt;lambda&gt; at 0x374c570&gt;</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.misc.count_true\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>How many elements is <tt class=\"docutils literal\"><span class=\"pre\">pred(elm)</span></tt> true for?</p>\n<p>With the default predicate, this counts the number of true elements.</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">count_true</span><span class=\"p\">([</span><span class=\"mf\">1</span><span class=\"p\">,</span> <span class=\"mf\">2</span><span class=\"p\">,</span> <span class=\"mf\">0</span><span class=\"p\">,</span> <span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"s\">&quot;&quot;</span><span class=\"p\">])</span>\n<span class=\"go\">3</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">count_true</span><span class=\"p\">([</span><span class=\"mf\">1</span><span class=\"p\">,</span> <span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"mf\">2</span><span class=\"p\">],</span> <span class=\"k\">lambda</span> <span class=\"n\">x</span><span class=\"p\">:</span> <span class=\"nb\">isinstance</span><span class=\"p\">(</span><span class=\"n\">x</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">))</span>\n<span class=\"go\">2</span>\n</pre></div>\n<p>This is equivalent to the <tt class=\"docutils literal\"><span class=\"pre\">itertools.quantify</span></tt> recipe, which I couldn&#8217;t\nget to work.</p>\n</dd></dl>\n\n<dl class=\"function\">\n<dt id=\"webhelpers.misc.convert_or_none\">\n<!--[webhelpers.misc.convert_or_none]--><tt class=\"descclassname\">webhelpers.misc.</tt><tt class=\"descname\">convert_or_none</tt><big>(</big><em>value</em>, <em>type_</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.misc.convert_or_none\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>Return the value converted to the type, or None if error.\n<tt class=\"docutils literal\"><span class=\"pre\">type_</span></tt> may be a Python type or any function taking one argument.</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">print</span> <span class=\"n\">convert_or_none</span><span class=\"p\">(</span><span class=\"s\">&quot;5&quot;</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">)</span>\n<span class=\"go\">5</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">print</span> <span class=\"n\">convert_or_none</span><span class=\"p\">(</span><span class=\"s\">&quot;A&quot;</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">)</span>\n<span class=\"go\">None</span>\n</pre></div>\n</dd></dl>\n\n<dl class=\"class\">\n<dt id=\"webhelpers.misc.DeclarativeException\">\n<!--[webhelpers.misc.DeclarativeException]-->class <tt class=\"descclassname\">webhelpers.misc.</tt><tt class=\"descname\">DeclarativeException</tt><big>(</big><em>message=None</em><big>)</big><a class=\"headerlink\" href=\"#webhelpers.misc.DeclarativeException\" title=\"Permalink to this definition\">\u00b6</a></dt>\n<dd><p>A simpler way to define an exception with a fixed message.</p>\n<p>Example:\n&gt;&gt;&gt; class MyException(DeclarativeException):\n...     message=&#8221;can&#8217;t frob the bar when foo is enabled&#8221;\n...\n&gt;&gt;&gt; try:\n...     raise MyException()\n... except Exception, e:\n...      print e\n...\ncan&#8217;t frob the bar when foo is enabled</p>\n</dd></dl>\n\n</div>\n</div>\n", 
   "current_page_name": "thirdparty/webhelpers/misc", 
   "display_toc": true, 
   "type": "Documentation", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 4de6c2f1ec9d74b6133bde57a05ec943
-ETag: 1313747432
+ETag: 2939149568
 
 {
   "_id": "4de6c2f1ec9d74b6133bde57a05ec943", 
-  "_rev": "1313747432", 
+  "_rev": "2939149568", 
   "builder": "pickle", 
   "copyright": "2008, Ben Bangert, James Gardner, Phil Jenvey", 
   "docstitle": "Pylons v0.9.7 documentation", 
   "use_opensearch": "", 
   "version": "0.9.7"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 506e0b58cd1cea302bea16f595f75b5e
-ETag: 16667908
+ETag: 3746010516
 
 {
   "_id": "506e0b58cd1cea302bea16f595f75b5e", 
-  "_rev": "16667908", 
+  "_rev": "3746010516", 
   "all_ratings": {
     "rating": null, 
     "username": null
   "type": "Snippet", 
   "username": "John Doe"
 }
---===============1582387333==
+--===============1827181674==
 Content-Type: application/json
 MIME-Version: 1.0
 Content-ID: 55dfc1b9c5a54cb3362a35373ea06a22
-ETag: 2863859133
+ETag: 1491186434
 
 {
   "_id": "55dfc1b9c5a54cb3362a35373ea06a22", 
-  "_rev": "2863859133", 
+  "_rev": "1491186434", 
   "body": "<div class=\"section\" id=\"id1\">\n<span id=\"controllers\"></span><h1>Controllers<a class=\"headerlink\" href=\"#id1\" title=\"Permalink to this headline\">\u00b6</a></h1>\n<img align=\"left\" alt=\"\" class=\"align-left\" src=\"../_images/pylon2.jpg\" style=\"width: 368px; height: 450px;\" />\n<p>In the <a class=\"reference external\" href=\"../glossary/#term-mvc\"><em class=\"xref\">MVC</em></a> paradigm the <em>controller</em> interprets the inputs, commanding\nthe model and/or the view to change as appropriate. Under Pylons, this concept\nis extended slightly in that a Pylons controller is not directly interpreting\nthe clients request, but is acting to determine the appropriate way to\nassemble data from the model, and render it with the correct template.</p>\n<p>The controller interprets requests from the user and calls portions of the model and view as necessary to fulfill the request. So when the user clicks a Web link or submits an HTML form, the controller itself doesn\u2019t output anything or perform any real processing. It takes the request and determines which model components to invoke and which formatting to apply to the resulting data.</p>\n<p>Pylons uses a class, where the superclass provides the <a class=\"reference external\" href=\"../glossary/#term-wsgi\"><em class=\"xref\">WSGI</em></a> interface\nand the subclass implements the application-specific controller logic.</p>\n<p>The Pylons WSGI Controller handles incoming web requests that are dispatched from the PylonsBaseWSGIApp.</p>\n<p>These requests result in a new instance of the WSGIController being created, which is then called with the dict options from the Routes match. The standard WSGI response is then returned with start_response called as per the WSGI spec.</p>\n<p>Since Pylons controllers are actually called with the WSGI interface, normal WSGI applications can also be Pylons \u2018controllers\u2019.</p>\n<div class=\"section\" id=\"standard-controllers\">\n<h2>Standard Controllers<a class=\"headerlink\" href=\"#standard-controllers\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Standard Controllers intended for subclassing by web developers</p>\n<div class=\"section\" id=\"keeping-methods-private\">\n<h3>Keeping methods private<a class=\"headerlink\" href=\"#keeping-methods-private\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Since the default route will map any controller and action, you will probably\nwant to prevent some methods in a controller from being callable from a URL.</p>\n<p>Routes uses the default Python convention of private methods beginning with\n<tt class=\"docutils literal\"><span class=\"pre\">_</span></tt>. To hide a method <tt class=\"docutils literal\"><span class=\"pre\">edit_generic</span></tt> in this class, just changing its name\nto begin with <tt class=\"docutils literal\"><span class=\"pre\">_</span></tt> will be sufficient:</p>\n<div class=\"highlight\"><pre><span class=\"k\">class</span> <span class=\"nc\">UserController</span><span class=\"p\">(</span><span class=\"n\">BaseController</span><span class=\"p\">):</span>\n        <span class=\"k\">def</span> <span class=\"nf\">index</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n                <span class=\"k\">return</span> <span class=\"n\">Response</span><span class=\"p\">(</span><span class=\"s\">&quot;This is the index.&quot;</span><span class=\"p\">)</span>\n\n        <span class=\"k\">def</span> <span class=\"nf\">_edit_generic</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n                <span class=\"s\">&quot;I can&#39;t be called from the web!&quot;</span>\n                <span class=\"k\">return</span> <span class=\"bp\">True</span>\n</pre></div>\n</div>\n<div class=\"section\" id=\"special-methods\">\n<h3>Special methods<a class=\"headerlink\" href=\"#special-methods\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Special controller methods you may define:</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__before__</span></tt></dt>\n<dd>This method will be run before your action is, and should be\nused for setting up variables/objects, restricting access to\nother actions, or other tasks which should be executed before\nthe action is called.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__after__</span></tt></dt>\n<dd>Method to run after the action is run. This method will\n<em>always</em> be run after your method, even if it raises an\nException or redirects.</dd>\n</dl>\n</div>\n<div class=\"section\" id=\"adding-controllers-dynamically\">\n<h3>Adding Controllers dynamically<a class=\"headerlink\" href=\"#adding-controllers-dynamically\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>It is possible for an application to add controllers without restarting the application. This requires telling Routes to re-scan the controllers directory.</p>\n<p>New controllers may be added from the command line with the paster command (recommended as that also creates the test harness file), or any other means of creating the controller file.</p>\n<p>For Routes to become aware of new controllers present in the controller directory, an internal flag is toggled to indicate that Routes should rescan the directory:</p>\n<div class=\"highlight\"><pre><span class=\"k\">from</span> <span class=\"nn\">routes</span> <span class=\"k\">import</span> <span class=\"n\">request_config</span>\n\n<span class=\"n\">mapper</span> <span class=\"o\">=</span> <span class=\"n\">request_config</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">mapper</span>\n<span class=\"n\">mapper</span><span class=\"o\">.</span><span class=\"n\">_created_regs</span> <span class=\"o\">=</span> <span class=\"bp\">False</span>\n</pre></div>\n<p>On the next request, Routes will rescan the controllers directory and those routes that use the <tt class=\"docutils literal\"><span class=\"pre\">:controller</span></tt> dynamic part of the path will be able to match the new controller.</p>\n</div>\n<div class=\"section\" id=\"attaching-wsgi-apps\">\n<h3>Attaching WSGI apps<a class=\"headerlink\" href=\"#attaching-wsgi-apps\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">This recipe assumes a basic level of familiarity with the WSGI Specification (PEP 333)</p>\n</div>\n<p>WSGI runs deep through Pylons, and is present in many parts of the architecture. Since Pylons controllers are actually called with the WSGI interface, normal WSGI applications can also be Pylons &#8216;controllers&#8217;.</p>\n<p>Optionally, if a full WSGI app should be mounted and handle the remainder of the URL, Routes can automatically move the right part of the URL into the <span class=\"target\" id=\"index-2\"></span><strong class=\"xref\">SCRIPT_NAME</strong>, so that the WSGI application can properly handle its <span class=\"target\" id=\"index-3\"></span><strong class=\"xref\">PATH_INFO</strong> part.</p>\n<p>This recipe will demonstrate adding a basic WSGI app as a Pylons controller.</p>\n<p>Create a new controller file in your Pylons project directory:</p>\n<pre>paster controller wsgiapp</pre>\n<p>This sets up the basic imports that you may want available when using other WSGI applications.</p>\n<p>Edit your controller so it looks like this:</p>\n<div class=\"highlight\"><pre><span class=\"k\">import</span> <span class=\"nn\">logging</span>\n\n<span class=\"k\">from</span> <span class=\"nn\">YOURPROJ.lib.base</span> <span class=\"k\">import</span> <span class=\"o\">*</span>\n\n<span class=\"n\">log</span> <span class=\"o\">=</span> <span class=\"n\">logging</span><span class=\"o\">.</span><span class=\"n\">getLogger</span><span class=\"p\">(</span><span class=\"n\">__name__</span><span class=\"p\">)</span>\n\n<span class=\"k\">def</span> <span class=\"nf\">WsgiappController</span><span class=\"p\">(</span><span class=\"n\">environ</span><span class=\"p\">,</span> <span class=\"n\">start_response</span><span class=\"p\">):</span>\n    <span class=\"n\">start_response</span><span class=\"p\">(</span><span class=\"s\">&#39;200 OK&#39;</span><span class=\"p\">,</span> <span class=\"p\">[(</span><span class=\"s\">&#39;Content-type&#39;</span><span class=\"p\">,</span> <span class=\"s\">&#39;text/plain&#39;</span><span class=\"p\">)])</span>\n    <span class=\"k\">return</span> <span class=\"p\">[</span><span class=\"s\">&quot;Hello World&quot;</span><span class=\"p\">]</span>\n</pre></div>\n<p>When hooking up other WSGI applications, they will expect the part of the URL that was used to get to this controller to have been moved into <span class=\"target\" id=\"index-4\"></span><strong class=\"xref\">SCRIPT_NAME</strong>. <tt class=\"xref docutils literal\"><span class=\"pre\">Routes</span></tt> can properly adjust the environ if a map route for this controller is added to the <tt class=\"docutils literal\"><span class=\"pre\">config/routing.py</span></tt> file:</p>\n<div class=\"highlight\"><pre><span class=\"c\"># CUSTOM ROUTES HERE</span>\n\n<span class=\"c\"># Map the WSGI application</span>\n<span class=\"nb\">map</span><span class=\"o\">.</span><span class=\"n\">connect</span><span class=\"p\">(</span><span class=\"s\">&#39;wsgiapp/*path_info&#39;</span><span class=\"p\">,</span> <span class=\"n\">controller</span><span class=\"o\">=</span><span class=\"s\">&#39;wsgiapp&#39;</span><span class=\"p\">)</span>\n</pre></div>\n<p>By specifying the <tt class=\"docutils literal\"><span class=\"pre\">path_info</span></tt> dynamic path, Routes will put everything leading up to the <tt class=\"docutils literal\"><span class=\"pre\">path_info</span></tt> in the <span class=\"target\" id=\"index-5\"></span><strong class=\"xref\">SCRIPT_NAME</strong> and the rest will go in the <span class=\"target\" id=\"index-6\"></span><strong class=\"xref\">PATH_INFO</strong>.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Is this still true of Routes 2?</p>\n</div>\n</div>\n</div>\n<div class=\"section\" id=\"using-the-wsgi-controller-to-provide-a-wsgi-service\">\n<h2>Using the WSGI Controller to provide a WSGI service<a class=\"headerlink\" href=\"#using-the-wsgi-controller-to-provide-a-wsgi-service\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"section\" id=\"the-pylons-wsgi-controller\">\n<h3>The Pylons WSGI Controller<a class=\"headerlink\" href=\"#the-pylons-wsgi-controller\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Pylons&#8217; own WSGI Controller follows the WSGI spec for calling and return\nvalues</p>\n<p>The Pylons WSGI Controller handles incoming web requests that are\ndispatched from the <tt class=\"docutils literal\"><span class=\"pre\">PylonsBaseWSGIApp</span></tt>. These requests result in a\nnew instance of the <tt class=\"docutils literal\"><span class=\"pre\">WSGIController</span></tt> being created, which is then\ncalled with the dict options from the Routes match. The standard\nWSGI response is then returned with <tt class=\"xref docutils literal\"><span class=\"pre\">start_response()</span></tt> called as per\nthe WSGI spec.</p>\n</div>\n<div class=\"section\" id=\"wsgicontroller-methods\">\n<h3>WSGIController methods<a class=\"headerlink\" href=\"#wsgicontroller-methods\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Special WSGIController methods you may define:</p>\n<dl class=\"docutils\">\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__before__</span></tt></dt>\n<dd>This method will be run before your action is, and should be\nused for setting up variables/objects, restricting access to\nother actions, or other tasks which should be executed before\nthe action is called.</dd>\n<dt><tt class=\"docutils literal\"><span class=\"pre\">__after__</span></tt></dt>\n<dd>Method to run after the action is run. This method will\n<em>always</em> be run after your method, even if it raises an\nException or redirects.</dd>\n</dl>\n<p>Each action to be called is inspected with <tt class=\"xref docutils literal\"><span class=\"pre\">_inspect_call()</span></tt> so\nthat it is only passed the arguments in the Routes match dict that\nit asks for. The arguments passed into the action can be customized\nby overriding the <tt class=\"xref docutils literal\"><span class=\"pre\">_get_method_args()</span></tt> function which is\nexpected to return a dict.</p>\n<p>In the event that an action is not found to handle the request, the\nController will raise an &#8220;Action Not Found&#8221; error if in debug mode,\notherwise a <tt class=\"docutils literal\"><span class=\"pre\">404</span> <span class=\"pre\">Not</span> <span class=\"pre\">Found</span></tt> error will be returned.</p>\n</div>\n</div>\n<div class=\"section\" id=\"using-the-rest-controller-with-a-restful-api\">\n<span id=\"rest-controller\"></span><h2>Using the REST Controller with a RESTful API<a class=\"headerlink\" href=\"#using-the-rest-controller-with-a-restful-api\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<div class=\"section\" id=\"using-the-paster-restcontroller-temlate\">\n<h3>Using the paster restcontroller temlate<a class=\"headerlink\" href=\"#using-the-paster-restcontroller-temlate\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<div class=\"highlight\"><pre><span class=\"nv\">$ </span>paster restcontroller --help\n</pre></div>\n<p>Create a REST Controller and accompanying functional test</p>\n<p>The RestController command will create a REST-based Controller file\nfor use with the <a title=\"routes.base.Mapper.resource\" class=\"reference external\" href=\"../thirdparty/routes/#routes.base.Mapper.resource\"><tt class=\"xref docutils literal\"><span class=\"pre\">resource()</span></tt></a>\nREST-based dispatching. This template includes the methods that\n<a title=\"routes.base.Mapper.resource\" class=\"reference external\" href=\"../thirdparty/routes/#routes.base.Mapper.resource\"><tt class=\"xref docutils literal\"><span class=\"pre\">resource()</span></tt></a> dispatches to in\naddition to doc strings for clarification on when the methods will\nbe called.</p>\n<p>The first argument should be the singular form of the REST\nresource. The second argument is the plural form of the word. If\nits a nested controller, put the directory information in front as\nshown in the second example below.</p>\n<p>Example usage:</p>\n<div class=\"highlight\"><pre>yourproj% paster restcontroller comment comments\nCreating yourproj/yourproj/controllers/comments.py\nCreating yourproj/yourproj/tests/functional/test_comments.py\n</pre></div>\n<p>If you&#8217;d like to have controllers underneath a directory, just\ninclude the path as the controller name and the necessary\ndirectories will be created for you:</p>\n<div class=\"highlight\"><pre>yourproj% paster restcontroller admin/tracback admin/trackbacks\nCreating yourproj/controllers/admin\nCreating yourproj/yourproj/controllers/admin/trackbacks.py\nCreating yourproj/yourproj/tests/functional/test_admin_trackbacks.py\n</pre></div>\n</div>\n<div class=\"section\" id=\"an-atom-style-rest-controller-for-users\">\n<h3>An Atom-Style REST Controller for Users<a class=\"headerlink\" href=\"#an-atom-style-rest-controller-for-users\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<div class=\"highlight\"><pre><span class=\"c\"># From http://pylonshq.com/pasties/503</span>\n<span class=\"k\">import</span> <span class=\"nn\">logging</span>\n\n<span class=\"k\">from</span> <span class=\"nn\">simplejson</span> <span class=\"k\">import</span> <span class=\"n\">dumps</span>\n<span class=\"k\">from</span> <span class=\"nn\">formencode.api</span> <span class=\"k\">import</span> <span class=\"n\">Invalid</span>\n<span class=\"k\">from</span> <span class=\"nn\">restmarks.lib.base</span> <span class=\"k\">import</span> <span class=\"o\">*</span>\n\n<span class=\"n\">log</span> <span class=\"o\">=</span> <span class=\"n\">logging</span><span class=\"o\">.</span><span class=\"n\">getLogger</span><span class=\"p\">(</span><span class=\"n\">__name__</span><span class=\"p\">)</span>\n\n<span class=\"k\">class</span> <span class=\"nc\">UsersController</span><span class=\"p\">(</span><span class=\"n\">BaseController</span><span class=\"p\">):</span>\n    <span class=\"sd\">&quot;&quot;&quot;REST Controller styled on the Atom Publishing Protocol&quot;&quot;&quot;</span>\n    <span class=\"c\"># To properly map this controller, ensure your</span>\n    <span class=\"c\"># config/routing.py file has a resource setup:</span>\n    <span class=\"c\">#     map.resource(&#39;user&#39;, &#39;users&#39;)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">index</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"n\">format</span><span class=\"o\">=</span><span class=\"s\">&#39;html&#39;</span><span class=\"p\">):</span>\n        <span class=\"sd\">&quot;&quot;&quot;GET /users: All items in the collection.&lt;br&gt;</span>\n<span class=\"sd\">            @param format the format passed from the URI.</span>\n<span class=\"sd\">        &quot;&quot;&quot;</span>\n        <span class=\"c\">#url_for(&#39;users&#39;)</span>\n        <span class=\"n\">users</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">User</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">()</span>\n        <span class=\"k\">if</span> <span class=\"n\">format</span><span class=\"o\">==</span><span class=\"s\">&#39;json&#39;</span><span class=\"p\">:</span>\n            <span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"p\">[]</span>\n            <span class=\"k\">for</span> <span class=\"n\">user</span> <span class=\"ow\">in</span> <span class=\"n\">users</span><span class=\"p\">:</span>\n                <span class=\"n\">d</span> <span class=\"o\">=</span> <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">_state</span><span class=\"p\">[</span><span class=\"s\">&#39;original&#39;</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">data</span>\n                <span class=\"k\">del</span> <span class=\"n\">d</span><span class=\"p\">[</span><span class=\"s\">&#39;password&#39;</span><span class=\"p\">]</span>\n                <span class=\"n\">d</span><span class=\"p\">[</span><span class=\"s\">&#39;link&#39;</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;user&#39;</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">name</span><span class=\"p\">)</span>\n                <span class=\"n\">data</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"n\">d</span><span class=\"p\">)</span>\n            <span class=\"n\">response</span><span class=\"o\">.</span><span class=\"n\">headers</span><span class=\"p\">[</span><span class=\"s\">&#39;content-type&#39;</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"s\">&#39;text/javascript&#39;</span>\n            <span class=\"k\">return</span> <span class=\"n\">dumps</span><span class=\"p\">(</span><span class=\"n\">data</span><span class=\"p\">)</span>\n        <span class=\"k\">else</span><span class=\"p\">:</span>\n            <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">users</span> <span class=\"o\">=</span> <span class=\"n\">users</span>\n            <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/users/index_user.mako&#39;</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">create</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"sd\">&quot;&quot;&quot;POST /users: Create a new item.&quot;&quot;&quot;</span>\n        <span class=\"c\"># url_for(&#39;users&#39;)</span>\n        <span class=\"n\">user</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">User</span><span class=\"o\">.</span><span class=\"n\">get_by</span><span class=\"p\">(</span><span class=\"n\">name</span><span class=\"o\">=</span><span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;name&#39;</span><span class=\"p\">])</span>\n        <span class=\"k\">if</span> <span class=\"n\">user</span><span class=\"p\">:</span>\n            <span class=\"c\"># The client tried to create a user that already exists</span>\n            <span class=\"n\">abort</span><span class=\"p\">(</span><span class=\"mf\">409</span><span class=\"p\">,</span> <span class=\"s\">&#39;409 Conflict&#39;</span><span class=\"p\">,</span>\n                  <span class=\"n\">headers</span><span class=\"o\">=</span><span class=\"p\">[(</span><span class=\"s\">&#39;location&#39;</span><span class=\"p\">,</span>\n                             <span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;user&#39;</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">name</span><span class=\"p\">)),</span> <span class=\"p\">])</span>\n        <span class=\"k\">else</span><span class=\"p\">:</span>\n            <span class=\"k\">try</span><span class=\"p\">:</span>\n                <span class=\"c\"># Validate the data that was sent to us</span>\n                <span class=\"n\">params</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">forms</span><span class=\"o\">.</span><span class=\"n\">UserForm</span><span class=\"o\">.</span><span class=\"n\">to_python</span><span class=\"p\">(</span><span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">params</span><span class=\"p\">)</span>\n            <span class=\"k\">except</span> <span class=\"n\">Invalid</span><span class=\"p\">,</span> <span class=\"n\">e</span><span class=\"p\">:</span>\n                <span class=\"c\"># Something didn&#39;t validate correctly</span>\n                <span class=\"n\">abort</span><span class=\"p\">(</span><span class=\"mf\">400</span><span class=\"p\">,</span> <span class=\"s\">&#39;400 Bad Request -- &#39;</span><span class=\"o\">+</span><span class=\"nb\">str</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"p\">))</span>\n            <span class=\"n\">user</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">User</span><span class=\"p\">(</span><span class=\"o\">**</span><span class=\"n\">params</span><span class=\"p\">)</span>\n            <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">objectstore</span><span class=\"o\">.</span><span class=\"n\">flush</span><span class=\"p\">()</span>\n            <span class=\"n\">response</span><span class=\"o\">.</span><span class=\"n\">headers</span><span class=\"p\">[</span><span class=\"s\">&#39;location&#39;</span><span class=\"p\">]</span> <span class=\"o\">=</span> \\\n                <span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;user&#39;</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">name</span><span class=\"p\">)</span>\n            <span class=\"n\">response</span><span class=\"o\">.</span><span class=\"n\">status_code</span> <span class=\"o\">=</span> <span class=\"mf\">201</span>\n            <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">user_name</span> <span class=\"o\">=</span> <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">name</span>\n            <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/users/created_user.mako&#39;</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">new</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"n\">format</span><span class=\"o\">=</span><span class=\"s\">&#39;html&#39;</span><span class=\"p\">):</span>\n        <span class=\"sd\">&quot;&quot;&quot;GET /users/new: Form to create a new item.</span>\n<span class=\"sd\">            @param format the format passed from the URI.</span>\n<span class=\"sd\">        &quot;&quot;&quot;</span>\n        <span class=\"c\"># url_for(&#39;new_user&#39;)</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/users/new_user.mako&#39;</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">update</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"p\">):</span>\n        <span class=\"sd\">&quot;&quot;&quot;PUT /users/id: Update an existing item.</span>\n<span class=\"sd\">            @param id the id (name) of the user to be updated</span>\n<span class=\"sd\">        &quot;&quot;&quot;</span>\n        <span class=\"c\"># Forms posted to this method should contain a hidden field:</span>\n        <span class=\"c\">#    &lt;input type=&quot;hidden&quot; name=&quot;_method&quot; value=&quot;PUT&quot; /&gt;</span>\n        <span class=\"c\"># Or using helpers:</span>\n        <span class=\"c\">#    h.form(h.url_for(&#39;user&#39;, id=ID),</span>\n        <span class=\"c\">#           method=&#39;put&#39;)</span>\n        <span class=\"c\"># url_for(&#39;user&#39;, id=ID)</span>\n        <span class=\"n\">old_name</span> <span class=\"o\">=</span> <span class=\"nb\">id</span>\n        <span class=\"n\">new_name</span> <span class=\"o\">=</span> <span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;name&#39;</span><span class=\"p\">]</span>\n        <span class=\"n\">user</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">User</span><span class=\"o\">.</span><span class=\"n\">get_by</span><span class=\"p\">(</span><span class=\"n\">name</span><span class=\"o\">=</span><span class=\"nb\">id</span><span class=\"p\">)</span>\n\n        <span class=\"k\">if</span> <span class=\"n\">user</span><span class=\"p\">:</span>\n            <span class=\"k\">if</span> <span class=\"p\">(</span><span class=\"n\">old_name</span> <span class=\"o\">!=</span> <span class=\"n\">new_name</span><span class=\"p\">)</span> <span class=\"ow\">and</span> \\\n                    <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">User</span><span class=\"o\">.</span><span class=\"n\">get_by</span><span class=\"p\">(</span><span class=\"n\">name</span><span class=\"o\">=</span><span class=\"n\">new_name</span><span class=\"p\">):</span>\n                <span class=\"n\">abort</span><span class=\"p\">(</span><span class=\"mf\">409</span><span class=\"p\">,</span> <span class=\"s\">&#39;409 Conflict&#39;</span><span class=\"p\">)</span>\n            <span class=\"k\">else</span><span class=\"p\">:</span>\n                <span class=\"n\">params</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">forms</span><span class=\"o\">.</span><span class=\"n\">UserForm</span><span class=\"o\">.</span><span class=\"n\">to_python</span><span class=\"p\">(</span><span class=\"n\">request</span><span class=\"o\">.</span><span class=\"n\">params</span><span class=\"p\">)</span>\n                <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">name</span> <span class=\"o\">=</span> <span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;name&#39;</span><span class=\"p\">]</span>\n                <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">full_name</span> <span class=\"o\">=</span> <span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;full_name&#39;</span><span class=\"p\">]</span>\n                <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">email</span> <span class=\"o\">=</span> <span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;email&#39;</span><span class=\"p\">]</span>\n                <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">password</span> <span class=\"o\">=</span> <span class=\"n\">params</span><span class=\"p\">[</span><span class=\"s\">&#39;password&#39;</span><span class=\"p\">]</span>\n                <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">objectstore</span><span class=\"o\">.</span><span class=\"n\">flush</span><span class=\"p\">()</span>\n                <span class=\"k\">if</span> <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">name</span> <span class=\"o\">!=</span> <span class=\"n\">old_name</span><span class=\"p\">:</span>\n                    <span class=\"n\">abort</span><span class=\"p\">(</span><span class=\"mf\">301</span><span class=\"p\">,</span> <span class=\"s\">&#39;301 Moved Permanently&#39;</span><span class=\"p\">,</span>\n                          <span class=\"p\">[(</span><span class=\"s\">&#39;Location&#39;</span><span class=\"p\">,</span>\n                            <span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;users&#39;</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">name</span><span class=\"p\">)),])</span>\n                <span class=\"k\">else</span><span class=\"p\">:</span>\n                    <span class=\"k\">return</span> <span class=\"s\">&#39;&#39;</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">delete</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"p\">):</span>\n        <span class=\"sd\">&quot;&quot;&quot;DELETE /users/id: Delete an existing item.</span>\n<span class=\"sd\">            @param id the id (name) of the user to be updated</span>\n<span class=\"sd\">        &quot;&quot;&quot;</span>\n        <span class=\"c\"># Forms posted to this method should contain a hidden field:</span>\n        <span class=\"c\">#    &lt;input type=&quot;hidden&quot; name=&quot;_method&quot; value=&quot;DELETE&quot; /&gt;</span>\n        <span class=\"c\"># Or using helpers:</span>\n        <span class=\"c\">#    h.form(h.url_for(&#39;user&#39;, id=ID),</span>\n        <span class=\"c\">#           method=&#39;delete&#39;)</span>\n        <span class=\"c\"># url_for(&#39;user&#39;, id=ID)</span>\n        <span class=\"n\">user</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">User</span><span class=\"o\">.</span><span class=\"n\">get_by</span><span class=\"p\">(</span><span class=\"n\">name</span><span class=\"o\">=</span><span class=\"nb\">id</span><span class=\"p\">)</span>\n        <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">delete</span><span class=\"p\">()</span>\n        <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">objectstore</span><span class=\"o\">.</span><span class=\"n\">flush</span><span class=\"p\">()</span>\n        <span class=\"k\">return</span> <span class=\"s\">&#39;&#39;</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">show</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"p\">,</span> <span class=\"n\">format</span><span class=\"o\">=</span><span class=\"s\">&#39;html&#39;</span><span class=\"p\">):</span>\n        <span class=\"sd\">&quot;&quot;&quot;GET /users/id: Show a specific item.</span>\n<span class=\"sd\">            @param id the id (name) of the user to be updated.</span>\n<span class=\"sd\">            @param format the format of the URI requested.</span>\n<span class=\"sd\">        &quot;&quot;&quot;</span>\n        <span class=\"c\"># url_for(&#39;user&#39;, id=ID)</span>\n        <span class=\"n\">user</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">User</span><span class=\"o\">.</span><span class=\"n\">get_by</span><span class=\"p\">(</span><span class=\"n\">name</span><span class=\"o\">=</span><span class=\"nb\">id</span><span class=\"p\">)</span>\n        <span class=\"k\">if</span> <span class=\"n\">user</span><span class=\"p\">:</span>\n            <span class=\"k\">if</span> <span class=\"n\">format</span><span class=\"o\">==</span><span class=\"s\">&#39;json&#39;</span><span class=\"p\">:</span>\n                <span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">_state</span><span class=\"p\">[</span><span class=\"s\">&#39;original&#39;</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">data</span>\n                <span class=\"k\">del</span> <span class=\"n\">data</span><span class=\"p\">[</span><span class=\"s\">&#39;password&#39;</span><span class=\"p\">]</span>\n                <span class=\"n\">data</span><span class=\"p\">[</span><span class=\"s\">&#39;link&#39;</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"n\">h</span><span class=\"o\">.</span><span class=\"n\">url_for</span><span class=\"p\">(</span><span class=\"s\">&#39;user&#39;</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">name</span><span class=\"p\">)</span>\n                <span class=\"n\">response</span><span class=\"o\">.</span><span class=\"n\">headers</span><span class=\"p\">[</span><span class=\"s\">&#39;content-type&#39;</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"s\">&#39;text/javascript&#39;</span>\n                <span class=\"k\">return</span> <span class=\"n\">dumps</span><span class=\"p\">(</span><span class=\"n\">data</span><span class=\"p\">)</span>\n            <span class=\"k\">else</span><span class=\"p\">:</span>\n                <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"n\">user</span>\n                <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/users/show_user.mako&#39;</span><span class=\"p\">)</span>\n        <span class=\"k\">else</span><span class=\"p\">:</span>\n            <span class=\"n\">abort</span><span class=\"p\">(</span><span class=\"mf\">404</span><span class=\"p\">,</span> <span class=\"s\">&#39;404 Not Found&#39;</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">edit</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"nb\">id</span><span class=\"p\">,</span> <span class=\"n\">format</span><span class=\"o\">=</span><span class=\"s\">&#39;html&#39;</span><span class=\"p\">):</span>\n        <span class=\"sd\">&quot;&quot;&quot;GET /users/id;edit: Form to edit an existing item.</span>\n<span class=\"sd\">            @param id the id (name) of the user to be updated.</span>\n<span class=\"sd\">            @param format the format of the URI requested.</span>\n<span class=\"sd\">        &quot;&quot;&quot;</span>\n        <span class=\"c\"># url_for(&#39;edit_user&#39;, id=ID)</span>\n        <span class=\"n\">user</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">User</span><span class=\"o\">.</span><span class=\"n\">get_by</span><span class=\"p\">(</span><span class=\"n\">name</span><span class=\"o\">=</span><span class=\"nb\">id</span><span class=\"p\">)</span>\n        <span class=\"k\">if</span> <span class=\"ow\">not</span> <span class=\"n\">user</span><span class=\"p\">:</span>\n            <span class=\"n\">abort</span><span class=\"p\">(</span><span class=\"mf\">404</span><span class=\"p\">,</span> <span class=\"s\">&#39;404 Not Found&#39;</span><span class=\"p\">)</span>\n        <span class=\"c\"># Get the form values from the table</span>\n        <span class=\"n\">c</span><span class=\"o\">.</span><span class=\"n\">values</span> <span class=\"o\">=</span> <span class=\"n\">model</span><span class=\"o\">.</span><span class=\"n\">forms</span><span class=\"o\">.</span><span class=\"n\">UserForm</span><span class=\"o\">.</span><span class=\"n\">from_python</span><span class=\"p\">(</span><span class=\"n\">user</span><span class=\"o\">.</span><span class=\"n\">__dict__</span><span class=\"p\">)</span>\n        <span class=\"k\">return</span> <span class=\"n\">render</span><span class=\"p\">(</span><span class=\"s\">&#39;/users/edit_user.mako&#39;</span><span class=\"p\">)</span>\n</pre></div>\n</div>\n</div>\n<div class=\"section\" id=\"using-the-xml-rpc-controller-for-xml-rpc-requests\">\n<span id=\"xmlrpc-controller\"></span><h2>Using the XML-RPC Controller for XML-RPC requests<a class=\"headerlink\" href=\"#using-the-xml-rpc-controller-for-xml-rpc-requests\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>In order to deploy this controller you will need at least a passing familiarity with XML-RPC itself. We will first review the basics of XML-RPC and then describe the workings of the <tt class=\"docutils literal\"><span class=\"pre\">Pylons</span> <span class=\"pre\">XMLRPCController</span></tt>. Finally, we will show an example of how to use the controller to implement a simple web service.</p>\n<p>After you&#8217;ve read this document, you may be interested in reading the companion document: &#8220;A blog publishing web service in XML-RPC&#8221; which takes the subject further, covering details of the MetaWeblog API (a popular XML-RPC service) and demonstrating how to construct some basic service methods to act as the core of a MetaWeblog blog publishing service.</p>\n<div class=\"section\" id=\"a-brief-introduction-to-xml-rpc\">\n<h3>A brief introduction to XML-RPC<a class=\"headerlink\" href=\"#a-brief-introduction-to-xml-rpc\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>XML-RPC is a specification that describes a Remote Procedure Call (RPC) interface by which an application can use the Internet to execute a specified procedure call on a remote XML-RPC server. The name of the procedure to be called and any required parameter values are &#8220;marshalled&#8221; into XML. The XML forms the body of a POST request which is despatched via HTTP to the XML-RPC server. At the server, the procedure is executed, the returned value(s) is/are marshalled into XML and despatched back to the application. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.</p>\n</div>\n<div class=\"section\" id=\"xml-rpc-controller-that-speaks-wsgi\">\n<h3>XML-RPC Controller that speaks WSGI<a class=\"headerlink\" href=\"#xml-rpc-controller-that-speaks-wsgi\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>Pylons uses Python&#8217;s xmlrpclib library to provide a specialised <tt class=\"xref docutils literal\"><span class=\"pre\">XMLRPCController</span></tt> class that gives you the full range of these XML-RPC Introspection facilities for use in your service methods and provides the foundation for constructing a set of specialised service methods that provide a useful web service &#8212; such as a blog publishing interface.</p>\n<p>This controller handles XML-RPC responses and complies with the <a class=\"reference external\" href=\"http://www.xmlrpc.com/spec\">XML-RPC Specification</a> as well as the <a class=\"reference external\" href=\"http://scripts.incutio.com/xmlrpc/introspection.html\">XML-RPC Introspection</a> specification.</p>\n<p>As part of its basic functionality an XML-RPC server provides three standard introspection procedures or &#8220;service methods&#8221; as they are called. The Pylons <tt class=\"xref docutils literal\"><span class=\"pre\">XMLRPCController</span></tt> class provides these standard service methods ready-made for you:</p>\n<ul class=\"simple\">\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">system.listMethods()</span></tt> Returns a list of XML-RPC methods for this XML-RPC resource</li>\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">system.methodSignature()</span></tt> Returns an array of arrays for the valid signatures for a method. The first value of each array is the return value of the method. The result is an array to indicate multiple signatures a method may be capable of.</li>\n<li><tt class=\"xref docutils literal\"><span class=\"pre\">system.methodHelp()</span></tt> Returns the documentation for a method</li>\n</ul>\n<p>By default, methods with names containing a dot are translated to use an underscore. For example, the <tt class=\"docutils literal\"><span class=\"pre\">system.methodHelp</span></tt> is handled by the method <tt class=\"xref docutils literal\"><span class=\"pre\">system_methodHelp()</span></tt>.</p>\n<p>Methods in the XML-RPC controller will be called with the method given in the XML-RPC body. Methods may be annotated with a signature attribute to declare the valid arguments and return types.</p>\n<p>For example:</p>\n<pre>class MyXML(XMLRPCController):\n    def userstatus(self):\n        return 'basic string'\n    userstatus.signature = [ [docmeta:'string'] ]\n\n    def userinfo(self, username, age=None):\n        user = LookUpUser(username)\n        response = {'username':user.name}\n        if age and age &gt; 10:\n            response[docmeta:'age'] = age\n        return response\n    userinfo.signature = [ [docmeta:'struct', 'string'],\n                           [docmeta:'struct', 'string', 'int'] ]</pre>\n<p>Since XML-RPC methods can take different sets of data, each set of valid arguments is its own list. The first value in the list is the type of the return argument. The rest of the arguments are the types of the data that must be passed in.</p>\n<p>In the last method in the example above, since the method can optionally take an integer value, both sets of valid parameter lists should be provided.</p>\n<p>Valid types that can be checked in the signature and their corresponding Python types:</p>\n<table border=\"1\" class=\"docutils\">\n<colgroup>\n<col width=\"50%\" />\n<col width=\"50%\" />\n</colgroup>\n<thead valign=\"bottom\">\n<tr><th class=\"head\">XMLRPC</th>\n<th class=\"head\">Python</th>\n</tr>\n</thead>\n<tbody valign=\"top\">\n<tr><td>string</td>\n<td>str</td>\n</tr>\n<tr><td>array</td>\n<td>list</td>\n</tr>\n<tr><td>boolean</td>\n<td>bool</td>\n</tr>\n<tr><td>int</td>\n<td>int</td>\n</tr>\n<tr><td>double</td>\n<td>float</td>\n</tr>\n<tr><td>struct</td>\n<td>dict</td>\n</tr>\n<tr><td>dateTime.iso8601</td>\n<td>xmlrpclib.DateTime</td>\n</tr>\n<tr><td>base64</td>\n<td>xmlrpclib.Binary</td>\n</tr>\n</tbody>\n</table>\n<p>Note, requiring a signature is optional.</p>\n<p>Also note that a convenient fault handler function is provided.</p>\n<div class=\"highlight\"><pre><span class=\"k\">def</span> <span class=\"nf\">xmlrpc_fault</span><span class=\"p\">(</span><span class=\"n\">code</span><span class=\"p\">,</span> <span class=\"n\">message</span><span class=\"p\">):</span>\n    <span class=\"sd\">&quot;&quot;&quot;Convenience method to return a Pylons response XMLRPC Fault&quot;&quot;&quot;</span>\n</pre></div>\n<p>(The <a class=\"reference external\" href=\"http://www.xmlrpc.com/\">XML-RPC Home page</a> and the <a class=\"reference external\" href=\"http://www.faqs.org/docs/Linux-HOWTO/XML-RPC-HOWTO.html\">XML-RPC HOW-TO</a> both provide further detail on the XML-RPC specification.)</p>\n</div>\n<div class=\"section\" id=\"a-simple-xml-rpc-service\">\n<h3>A simple XML-RPC service<a class=\"headerlink\" href=\"#a-simple-xml-rpc-service\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>This simple service <tt class=\"docutils literal\"><span class=\"pre\">test.battingOrder</span></tt> accepts a positive integer &lt; 51 as the parameter <tt class=\"docutils literal\"><span class=\"pre\">posn</span></tt> and returns a string containing the name of the US state occupying that ranking in the order of ratifying the constitution / joining the union.</p>\n<pre>import xmlrpclib\nimport pylons\nfrom pylons import request\nfrom pylons.controllers import XMLRPCController\nfrom myapp.lib.base import *\n\nstates = [docmeta:'Delaware', 'Pennsylvania', 'New Jersey',\n         'Georgia', 'Connecticut', 'Massachusetts', 'Maryland',\n         'South Carolina', 'New Hampshire', 'Virginia', 'New York',\n         'North Carolina', 'Rhode Island', 'Vermont', 'Kentucky',\n         'Tennessee', 'Ohio', 'Louisiana', 'Indiana', 'Mississippi',\n         'Illinois', 'Alabama', 'Maine', 'Missouri', 'Arkansas',\n         'Michigan', 'Florida', 'Texas', 'Iowa', 'Wisconsin',\n         'California', 'Minnesota', 'Oregon', 'Kansas', 'West Virginia',\n         'Nevada', 'Nebraska', 'Colorado', 'North Dakota', 'South Dakota',\n         'Montana', 'Washington', 'Idaho', 'Wyoming', 'Utah', 'Oklahoma',\n         'New Mexico', 'Arizona', 'Alaska', 'Hawaii']\n\nclass RpctestController(XMLRPCController):\n\n    def test_battingOrder(self, posn):\n        \"\"\"This docstring becomes the content of the\n        returned value for system.methodHelp called with\n        the parameter \"test.battingOrder\"). The method\n        signature will be appended below ...\n        \"\"\"\n        # XML-RPC checks agreement for arity and parameter datatype, so\n        # by the time we get called, we know we have an int.\n        if posn &gt; 0 and posn &lt; 51:\n            return states[docmeta:posn-1]\n        else:\n            # Technically, the param value is correct: it is an int.\n            # Raising an error is inappropriate, so instead we\n            # return a facetious message as a string.\n            return 'Out of cheese error.'\n    test_battingOrder.signature = [ [docmeta:'string', 'int'] ]</pre>\n</div>\n<div class=\"section\" id=\"testing-the-service\">\n<h3>Testing the service<a class=\"headerlink\" href=\"#testing-the-service\" title=\"Permalink to this headline\">\u00b6</a></h3>\n<p>For developers using OS X, there&#8217;s an <a class=\"reference external\" href=\"http://www.ditchnet.org/xmlrpc/\">XML/RPC client</a> that is an extremely useful diagnostic tool when developing XML-RPC (it&#8217;s free ... but not entirely bug-free). Or, you can just use the Python interpreter:</p>\n<div class=\"highlight\"><pre><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">from</span> <span class=\"nn\">pprint</span> <span class=\"k\">import</span> <span class=\"n\">pprint</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">import</span> <span class=\"nn\">xmlrpclib</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">srvr</span> <span class=\"o\">=</span> <span class=\"n\">xmlrpclib</span><span class=\"o\">.</span><span class=\"n\">Server</span><span class=\"p\">(</span><span class=\"s\">&quot;http://example.com/rpctest/&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">pprint</span><span class=\"p\">(</span><span class=\"n\">srvr</span><span class=\"o\">.</span><span class=\"n\">system</span><span class=\"o\">.</span><span class=\"n\">listMethods</span><span class=\"p\">())</span>\n<span class=\"go\">[docmeta:&#39;system.listMethods&#39;,</span>\n<span class=\"go\">&#39;system.methodHelp&#39;,</span>\n<span class=\"go\">&#39;system.methodSignature&#39;,</span>\n<span class=\"go\">&#39;test.battingOrder&#39;]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">print</span> <span class=\"n\">srvr</span><span class=\"o\">.</span><span class=\"n\">system</span><span class=\"o\">.</span><span class=\"n\">methodHelp</span><span class=\"p\">(</span><span class=\"s\">&#39;test.battingOrder&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">This docstring becomes the content of the</span>\n<span class=\"go\">returned value for system.methodHelp called with</span>\n<span class=\"go\">the parameter &quot;test.battingOrder&quot;). The method</span>\n<span class=\"go\">signature will be appended below ...</span>\n\n<span class=\"go\">Method signature: [docmeta:[&#39;string&#39;, &#39;int&#39;]]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">pprint</span><span class=\"p\">(</span><span class=\"n\">srvr</span><span class=\"o\">.</span><span class=\"n\">system</span><span class=\"o\">.</span><span class=\"n\">methodSignature</span><span class=\"p\">(</span><span class=\"s\">&#39;test.battingOrder&#39;</span><span class=\"p\">))</span>\n<span class=\"go\">[docmeta:[&#39;string&#39;, &#39;int&#39;]]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">pprint</span><span class=\"p\">(</span><span class=\"n\">srvr</span><span class=\"o\">.</span><span class=\"n\">test</span><span class=\"o\">.</span><span class=\"n\">battingOrder</span><span class=\"p\">(</span><span class=\"mf\">12</span><span class=\"p\">))</span>\n<span class=\"go\">&#39;North Carolina&#39;</span>\n</pre></div>\n<p>To debug XML-RPC servers from Python, create the client object using the optional verbose=1 parameter. You can then use the client as normal and watch as the XML-RPC request and response is displayed in the console.</p>\n</div>\n</div>\n</div>\n", 
   "current_page_name": "controllers", 
   "display_toc": true, 
   "type": "Documentation", 
   "version&q