src/build/html/pyams_utils.html
changeset 0 d153941bb745
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/build/html/pyams_utils.html	Sun Jan 14 11:48:51 2018 +0100
@@ -0,0 +1,2524 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>PyAMS utilities &#8212; PyAMS User Guide 0.1.0 documentation</title>
+    <link rel="stylesheet" href="_static/pyramid.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    './',
+        VERSION:     '0.1.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true,
+        SOURCELINK_SUFFIX: '.txt'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/underscore.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="index" title="Index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+<!--[if lte IE 6]>
+<link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
+<![endif]-->
+
+  </head>
+  <body>
+
+    <div class="related" role="navigation" aria-label="related navigation">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> &#187;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body" role="main">
+            
+  <div class="section" id="pyams-utilities">
+<span id="pyams-utils"></span><h1>PyAMS utilities<a class="headerlink" href="#pyams-utilities" title="Permalink to this headline">¶</a></h1>
+<div class="section" id="subpackages">
+<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="pyams_utils.interfaces.html">pyams_utils.interfaces package</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces">Module contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.interfaces.html#submodules">Submodules</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.data">pyams_utils.interfaces.data module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.intids">pyams_utils.interfaces.intids module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.site">pyams_utils.interfaces.site module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.size">pyams_utils.interfaces.size module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.tales">pyams_utils.interfaces.tales module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.text">pyams_utils.interfaces.text module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.timezone">pyams_utils.interfaces.timezone module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.traversing">pyams_utils.interfaces.traversing module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.tree">pyams_utils.interfaces.tree module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces.zeo">pyams_utils.interfaces.zeo module</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="pyams_utils.protocol.html">pyams_utils.protocol package</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.protocol.html#module-pyams_utils.protocol">Module contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.protocol.html#submodules">Submodules</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.protocol.html#module-pyams_utils.protocol.http">pyams_utils.protocol.http module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.protocol.html#module-pyams_utils.protocol.xmlrpc">pyams_utils.protocol.xmlrpc module</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="pyams_utils.scripts.html">pyams_utils.scripts package</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.scripts.html#module-pyams_utils.scripts">Module contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.scripts.html#submodules">Submodules</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.scripts.html#module-pyams_utils.scripts.zodb">pyams_utils.scripts.zodb module</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="pyams_utils.tests.html">pyams_utils.tests package</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.tests.html#module-pyams_utils.tests">Module contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.tests.html#submodules">Submodules</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.tests.html#module-pyams_utils.tests.test_utilsdocs">pyams_utils.tests.test_utilsdocs module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.tests.html#module-pyams_utils.tests.test_utilsdocstrings">pyams_utils.tests.test_utilsdocstrings module</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="pyams_utils.timezone.html">pyams_utils.timezone package</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.timezone.html#module-pyams_utils.timezone">Module contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.timezone.html#submodules">Submodules</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.timezone.html#module-pyams_utils.timezone.utility">pyams_utils.timezone.utility module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.timezone.html#module-pyams_utils.timezone.vocabulary">pyams_utils.timezone.vocabulary module</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="pyams_utils.widget.html">pyams_utils.widget package</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.widget.html#module-pyams_utils.widget">Module contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.widget.html#submodules">Submodules</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.widget.html#module-pyams_utils.widget.decimal">pyams_utils.widget.decimal module</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="pyams_utils.zmi.html">pyams_utils.zmi package</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.zmi.html#module-pyams_utils.zmi">Module contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pyams_utils.zmi.html#submodules">Submodules</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.zmi.html#module-pyams_utils.zmi.intids">pyams_utils.zmi.intids module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.zmi.html#module-pyams_utils.zmi.timezone">pyams_utils.zmi.timezone module</a></li>
+<li class="toctree-l3"><a class="reference internal" href="pyams_utils.zmi.html#module-pyams_utils.zmi.zeo">pyams_utils.zmi.zeo module</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+<div class="section" id="module-pyams_utils">
+<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pyams_utils" title="Permalink to this headline">¶</a></h2>
+<dl class="function">
+<dt id="pyams_utils.includeme">
+<code class="descclassname">pyams_utils.</code><code class="descname">includeme</code><span class="sig-paren">(</span><em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.includeme" title="Permalink to this definition">¶</a></dt>
+<dd><p>pyams_utils features include</p>
+</dd></dl>
+
+</div>
+<div class="section" id="submodules">
+<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
+<div class="section" id="module-pyams_utils.adapter">
+<span id="pyams-utils-adapter-module"></span><h3>pyams_utils.adapter module<a class="headerlink" href="#module-pyams_utils.adapter" title="Permalink to this headline">¶</a></h3>
+<p>Adapters management package</p>
+<p>This package provides a small set of standard base adapters for <em>context</em>, <em>context</em> and <em>request</em>, and
+<em>context</em> and <em>request</em> and <em>view</em>.</p>
+<p>See <a class="reference internal" href="zca.html#zca"><span class="std std-ref">Managing ZCA with PyAMS</span></a> to see how PyAMS can help components management.</p>
+<dl class="class">
+<dt id="pyams_utils.adapter.ContextAdapter">
+<em class="property">class </em><code class="descclassname">pyams_utils.adapter.</code><code class="descname">ContextAdapter</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.adapter.ContextAdapter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Context adapter</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.adapter.ContextRequestAdapter">
+<em class="property">class </em><code class="descclassname">pyams_utils.adapter.</code><code class="descname">ContextRequestAdapter</code><span class="sig-paren">(</span><em>context</em>, <em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.adapter.ContextRequestAdapter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Context + request multi-adapter</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.adapter.ContextRequestViewAdapter">
+<em class="property">class </em><code class="descclassname">pyams_utils.adapter.</code><code class="descname">ContextRequestViewAdapter</code><span class="sig-paren">(</span><em>context</em>, <em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.adapter.ContextRequestViewAdapter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Context + request + view multi-adapter</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.adapter.NullAdapter">
+<em class="property">class </em><code class="descclassname">pyams_utils.adapter.</code><code class="descname">NullAdapter</code><a class="headerlink" href="#pyams_utils.adapter.NullAdapter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>An adapter which always return None!</p>
+<p>Can be useful to override a default adapter…</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.adapter.adapter_config">
+<em class="property">class </em><code class="descclassname">pyams_utils.adapter.</code><code class="descname">adapter_config</code><span class="sig-paren">(</span><em>**settings</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.adapter.adapter_config" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Function or class decorator to declare an adapter</p>
+<p>Annotation parameters can be:</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>name</strong> (<em>str</em>) – (default=’‘), name of the adapter</li>
+<li><strong>context</strong> (<em>[</em><em>Interface...</em><em>]</em>) – an interface, or a tuple of interfaces, that the component adapts</li>
+<li><strong>provides</strong> (<em>Interface</em>) – the interface that the adapter provides</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<dl class="attribute">
+<dt id="pyams_utils.adapter.adapter_config.venusian">
+<code class="descname">venusian</code><em class="property"> = &lt;module 'venusian' from '/var/local/env/pyams/eggs/venusian-1.1.0-py3.5.egg/venusian/__init__.py'&gt;</em><a class="headerlink" href="#pyams_utils.adapter.adapter_config.venusian" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.attr">
+<span id="pyams-utils-attr-module"></span><h3>pyams_utils.attr module<a class="headerlink" href="#module-pyams_utils.attr" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.attr.AttributeTraverser">
+<em class="property">class </em><code class="descclassname">pyams_utils.attr.</code><code class="descname">AttributeTraverser</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.attr.AttributeTraverser" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextAdapter" title="pyams_utils.adapter.ContextAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextAdapter</span></code></a></p>
+<p>++attr++ namespace traverser</p>
+<p>This custom traversing adapter can be used to access an object attribute directly from
+an URL by using a path like this:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="nb">object</span><span class="o">/++</span><span class="n">attr</span><span class="o">++</span><span class="n">name</span>
+</pre></div>
+</div>
+<p>Whare <em>name</em> is the name of the requested attribute</p>
+<dl class="method">
+<dt id="pyams_utils.attr.AttributeTraverser.traverse">
+<code class="descname">traverse</code><span class="sig-paren">(</span><em>name</em>, <em>furtherpath=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.attr.AttributeTraverser.traverse" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.container">
+<span id="pyams-utils-container-module"></span><h3>pyams_utils.container module<a class="headerlink" href="#module-pyams_utils.container" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.container.BTreeOrderedContainer">
+<em class="property">class </em><code class="descclassname">pyams_utils.container.</code><code class="descname">BTreeOrderedContainer</code><a class="headerlink" href="#pyams_utils.container.BTreeOrderedContainer" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.container.ordered.OrderedContainer</span></code></p>
+<p>BTree based ordered container</p>
+<p>This container maintain a manual order of it’s contents</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.container.ContainerSublocationsAdapter">
+<em class="property">class </em><code class="descclassname">pyams_utils.container.</code><code class="descname">ContainerSublocationsAdapter</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.container.ContainerSublocationsAdapter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextAdapter" title="pyams_utils.adapter.ContextAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextAdapter</span></code></a></p>
+<p>Contained object sub-locations adapter</p>
+<p>This adapter checks for custom ISublocations interface adapters which can
+be defined by any component to get access to inner locations, defined for
+example via annotations.</p>
+<dl class="method">
+<dt id="pyams_utils.container.ContainerSublocationsAdapter.sublocations">
+<code class="descname">sublocations</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.container.ContainerSublocationsAdapter.sublocations" title="Permalink to this definition">¶</a></dt>
+<dd><p>See <cite>zope.location.interfaces.ISublocations</cite> interface</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.container.find_objects_matching">
+<code class="descclassname">pyams_utils.container.</code><code class="descname">find_objects_matching</code><span class="sig-paren">(</span><em>root</em>, <em>condition</em>, <em>ignore_root=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.container.find_objects_matching" title="Permalink to this definition">¶</a></dt>
+<dd><p>Find all objects in root that match the condition</p>
+<p>The condition is a Python callable object that takes an object as
+argument and must return a boolean result.</p>
+<p>All sub-objects of the root will also be searched recursively.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>root</strong> (<em>object</em>) – the parent object from which search is started</li>
+<li><strong>condition</strong> (<em>callable</em>) – a callable object which may return true for a given
+object to be selected</li>
+<li><strong>ignore_root</strong> (<em>boolean</em>) – if <em>True</em>, the root object will not be returned, even if it matches
+the given condition</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">an iterator for all root’s sub-objects matching condition</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.container.find_objects_providing">
+<code class="descclassname">pyams_utils.container.</code><code class="descname">find_objects_providing</code><span class="sig-paren">(</span><em>root</em>, <em>interface</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.container.find_objects_providing" title="Permalink to this definition">¶</a></dt>
+<dd><p>Find all objects in root that provide the specified interface</p>
+<p>All sub-objects of the root will also be searched recursively.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>root</strong> (<em>object</em>) – object; the parent object from which search is started</li>
+<li><strong>interface</strong> (<em>Interface</em>) – interface; an interface that sub-objects should provide</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">an iterator for all root’s sub-objects that provide the given interface</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.context">
+<span id="pyams-utils-context-module"></span><h3>pyams_utils.context module<a class="headerlink" href="#module-pyams_utils.context" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.context.ContextSelector">
+<em class="property">class </em><code class="descclassname">pyams_utils.context.</code><code class="descname">ContextSelector</code><span class="sig-paren">(</span><em>ifaces</em>, <em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.context.ContextSelector" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Interface based context selector</p>
+<p>This selector can be used as a subscriber predicate to define
+an interface that the context must support for the event to be applied:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">python</span>
+</pre></div>
+</div>
+<blockquote>
+<div><p>from pyams_utils.interfaces.site import ISiteRoot</p>
+<p>&#64;subscriber(IObjectModifiedEvent, context_selector=ISiteRoot)
+def siteroot_modified_event_handler(event):</p>
+<blockquote>
+<div>‘’‘This is an event handler for an ISiteRoot object modification event’‘’</div></blockquote>
+</div></blockquote>
+<dl class="method">
+<dt id="pyams_utils.context.ContextSelector.phash">
+<code class="descname">phash</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.context.ContextSelector.phash" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.context.ContextSelector.text">
+<code class="descname">text</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.context.ContextSelector.text" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.data">
+<span id="pyams-utils-data-module"></span><h3>pyams_utils.data module<a class="headerlink" href="#module-pyams_utils.data" title="Permalink to this headline">¶</a></h3>
+<p>Object data API module</p>
+<p>The <em>IObjectData</em> interface is a generic interface which can be used to assign custom data to nay object.
+This object data may be any object which can be serialized to JSON, and assigned to any HTML <em>data</em> attribute.
+It can typically be used to set a <em>data-ams-data</em> attribute to objects, which is afterwards converted to
+classic <em>data-</em> attributes by <strong>MyAMS.js</strong> framework.</p>
+<p>For example, for a custom widget in a form:</p>
+<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">updateWidgets</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+    <span class="nb">super</span><span class="p">(</span><span class="n">MyForm</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">updateWidgets</span><span class="p">()</span>
+    <span class="n">widget</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">widgets</span><span class="p">[</span><span class="s1">&#39;mywidget&#39;</span><span class="p">]</span>
+    <span class="n">alsoProvides</span><span class="p">(</span><span class="n">widget</span><span class="p">,</span> <span class="n">IObjectData</span><span class="p">)</span>
+    <span class="n">widget</span><span class="o">.</span><span class="n">object_data</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;ams-colorpicker-position&#39;</span><span class="p">:</span> <span class="s1">&#39;top left&#39;</span><span class="p">}</span>
+</pre></div>
+</div>
+<p>You can then set an attribute in a TAL template like this:</p>
+<div class="highlight-html"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">tal:attributes</span><span class="o">=</span><span class="s">&quot;data-ams-data extension:object_data(widget)&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
+</pre></div>
+</div>
+<p>After data initialization by <strong>MyAMS.js</strong>, the following code will be converted to:</p>
+<div class="highlight-html"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">data-ams-colorpicker-position</span><span class="o">=</span><span class="s">&quot;top left&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
+</pre></div>
+</div>
+<dl class="class">
+<dt id="pyams_utils.data.BrowserRequestDataExtension">
+<em class="property">class </em><code class="descclassname">pyams_utils.data.</code><code class="descname">BrowserRequestDataExtension</code><span class="sig-paren">(</span><em>context</em>, <em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.data.BrowserRequestDataExtension" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextRequestViewAdapter" title="pyams_utils.adapter.ContextRequestViewAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextRequestViewAdapter</span></code></a></p>
+<p>extension:request_data TALES extension for Zope browser request</p>
+<p>This TALES extension can be used to get a request data, previously stored in the request via an annotation.
+For example:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">html</span>
+</pre></div>
+</div>
+<blockquote>
+<div>&lt;div tal:content=”extension:request_data(‘my.annotation.key’)”&gt;…&lt;/div&gt;</div></blockquote>
+<dl class="method">
+<dt id="pyams_utils.data.BrowserRequestDataExtension.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>params=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.data.BrowserRequestDataExtension.render" title="Permalink to this definition">¶</a></dt>
+<dd><p>See <cite>pyams_utils.interfaces.tales.ITALESExtension</cite> interface</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.data.ObjectDataExtension">
+<em class="property">class </em><code class="descclassname">pyams_utils.data.</code><code class="descname">ObjectDataExtension</code><span class="sig-paren">(</span><em>context</em>, <em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.data.ObjectDataExtension" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextRequestViewAdapter" title="pyams_utils.adapter.ContextRequestViewAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextRequestViewAdapter</span></code></a></p>
+<p>extension:object_data TALES extension</p>
+<p>This TALES extension is to be used in Chameleon templates to define a custom data attribute
+which stores all object data (see <cite>pyams_utils.interfaces.data.IObjectData</cite> interface), like this:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">html</span>
+</pre></div>
+</div>
+<blockquote>
+<div>&lt;div tal:attributes=”data-ams-data extension:object_data(context)”&gt;…&lt;/div&gt;</div></blockquote>
+<dl class="method">
+<dt id="pyams_utils.data.ObjectDataExtension.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>context=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.data.ObjectDataExtension.render" title="Permalink to this definition">¶</a></dt>
+<dd><p>See <cite>pyams_utils.interfaces.tales.ITALESExtension</cite> interface</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.data.ObjectDataRenderer">
+<em class="property">class </em><code class="descclassname">pyams_utils.data.</code><code class="descname">ObjectDataRenderer</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.data.ObjectDataRenderer" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextAdapter" title="pyams_utils.adapter.ContextAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextAdapter</span></code></a></p>
+<p>Object data JSON renderer</p>
+<dl class="method">
+<dt id="pyams_utils.data.ObjectDataRenderer.get_object_data">
+<code class="descname">get_object_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.data.ObjectDataRenderer.get_object_data" title="Permalink to this definition">¶</a></dt>
+<dd><p>See <cite>pyams_utils.interfaces.data.IObjectDataRenderer</cite> interface</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.data.PyramidRequestDataExtension">
+<em class="property">class </em><code class="descclassname">pyams_utils.data.</code><code class="descname">PyramidRequestDataExtension</code><span class="sig-paren">(</span><em>context</em>, <em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.data.PyramidRequestDataExtension" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextRequestViewAdapter" title="pyams_utils.adapter.ContextRequestViewAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextRequestViewAdapter</span></code></a></p>
+<p>extension:request_data TALES extension for Pyramid request</p>
+<p>This TALES extension can be used to get a request data, previously stored in the request via an annotation.
+For example:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">html</span>
+</pre></div>
+</div>
+<blockquote>
+<div>&lt;div tal:content=”extension:request_data(‘my.annotation.key’)”&gt;…&lt;/div&gt;</div></blockquote>
+<dl class="method">
+<dt id="pyams_utils.data.PyramidRequestDataExtension.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>params=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.data.PyramidRequestDataExtension.render" title="Permalink to this definition">¶</a></dt>
+<dd><p>See <cite>pyams_utils.interfaces.tales.ITALESExtension</cite> interface</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.date">
+<span id="pyams-utils-date-module"></span><h3>pyams_utils.date module<a class="headerlink" href="#module-pyams_utils.date" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.date.date_to_datetime">
+<code class="descclassname">pyams_utils.date.</code><code class="descname">date_to_datetime</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.date.date_to_datetime" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get datetime value converted from a date or datetime object</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<em>date/datetime</em>) – a date or datetime value to convert</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">datetime; input value converted to datetime</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">date</span><span class="p">,</span> <span class="n">datetime</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.date</span> <span class="k">import</span> <span class="n">date_to_datetime</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">value</span> <span class="o">=</span> <span class="n">date</span><span class="p">(</span><span class="mi">2016</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date_to_datetime</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+<span class="go">datetime.datetime(2016, 11, 15, 0, 0)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">value</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2016</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">value</span>
+<span class="go">datetime.datetime(2016, 11, 15, 10, 13, 12)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date_to_datetime</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="ow">is</span> <span class="n">value</span>
+<span class="go">True</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.date.format_date">
+<code class="descclassname">pyams_utils.date.</code><code class="descname">format_date</code><span class="sig-paren">(</span><em>value</em>, <em>format='on %d/%m/%Y'</em>, <em>request=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.date.format_date" title="Permalink to this definition">¶</a></dt>
+<dd><p>Format given date with the given format</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>value</strong> (<em>datetime</em>) – the value to format</li>
+<li><strong>format</strong> (<em>str</em>) – a format string to use by <cite>strftime</cite> function</li>
+<li><strong>request</strong> – the request from which to extract localization info for translation</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">str; input datetime converted to given format</p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">datetime</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.date</span> <span class="k">import</span> <span class="n">format_date</span><span class="p">,</span> <span class="n">SH_DATE_FORMAT</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">value</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2016</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">format_date</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+<span class="go">&#39;on 15/11/2016&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">format_date</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">SH_DATE_FORMAT</span><span class="p">)</span>
+<span class="go">&#39;15/11/2016&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.date.format_datetime">
+<code class="descclassname">pyams_utils.date.</code><code class="descname">format_datetime</code><span class="sig-paren">(</span><em>value</em>, <em>format='on %d/%m/%Y at %H:%M'</em>, <em>request=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.date.format_datetime" title="Permalink to this definition">¶</a></dt>
+<dd><p>Format given datetime with the given format including time</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>value</strong> (<em>datetime</em>) – the value to format</li>
+<li><strong>format</strong> (<em>str</em>) – a format string to use by <cite>strftime</cite> function</li>
+<li><strong>request</strong> – request; the request from which to extract localization info for translation</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">str; input datetime converted to given format</p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">datetime</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.date</span> <span class="k">import</span> <span class="n">format_datetime</span><span class="p">,</span> <span class="n">SH_DATETIME_FORMAT</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">value</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2016</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">format_datetime</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+<span class="go">&#39;on 15/11/2016 at 10:13&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">format_datetime</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">SH_DATETIME_FORMAT</span><span class="p">)</span>
+<span class="go">&#39;15/11/2016 - 10:13&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.date.get_age">
+<code class="descclassname">pyams_utils.date.</code><code class="descname">get_age</code><span class="sig-paren">(</span><em>value</em>, <em>request=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.date.get_age" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get ‘human’ age of a given datetime (including timezone) compared to current datetime (in UTC)</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<em>datetime</em>) – input datetime to be compared with current datetime</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">str; the delta value, converted to months, weeks, days, hours or minutes</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.date.get_duration">
+<code class="descclassname">pyams_utils.date.</code><code class="descname">get_duration</code><span class="sig-paren">(</span><em>v1</em>, <em>v2=None</em>, <em>request=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.date.get_duration" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get ‘human’ delta as string between two dates</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>v1</strong> (<em>datetime</em>) – start date</li>
+<li><strong>v2</strong> (<em>datetime</em>) – end date, or current date (in UTC) if None</li>
+<li><strong>request</strong> – the request from which to extract localization infos</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">str; approximate delta between the two input dates</p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">datetime</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.date</span> <span class="k">import</span> <span class="n">get_duration</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyramid.testing</span> <span class="k">import</span> <span class="n">DummyRequest</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">request</span> <span class="o">=</span> <span class="n">DummyRequest</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date1</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2015</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date2</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2014</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date1</span><span class="p">,</span> <span class="n">date2</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;10 months&#39;</span>
+</pre></div>
+</div>
+<p>Dates order is not important:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date2</span><span class="p">,</span> <span class="n">date1</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;10 months&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date2</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2014</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date1</span><span class="p">,</span> <span class="n">date2</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;7 weeks&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date2</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2014</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">26</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date1</span><span class="p">,</span> <span class="n">date2</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;6 days&#39;</span>
+</pre></div>
+</div>
+<p>For durations lower than 2 days, duration also display hours:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">date1</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2015</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date2</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2015</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date1</span><span class="p">,</span> <span class="n">date2</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;1 day and 15 hours&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date2</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2015</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date1</span><span class="p">,</span> <span class="n">date2</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;24 hours&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date2</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2015</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date1</span><span class="p">,</span> <span class="n">date2</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;13 hours&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date2</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2015</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date1</span><span class="p">,</span> <span class="n">date2</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;75 minutes&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">date2</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2015</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_duration</span><span class="p">(</span><span class="n">date1</span><span class="p">,</span> <span class="n">date2</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;15 seconds&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.date.parse_date">
+<code class="descclassname">pyams_utils.date.</code><code class="descname">parse_date</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.date.parse_date" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get date specified in unicode ISO format to Python datetime object</p>
+<p>Dates are always assumed to be stored in GMT timezone</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<em>str</em>) – unicode date to be parsed</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">datetime; the specified value, converted to datetime</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.date</span> <span class="k">import</span> <span class="n">parse_date</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">parse_date</span><span class="p">(</span><span class="s1">&#39;2016-11-15T10:13:12+00:00&#39;</span><span class="p">)</span>
+<span class="go">datetime.datetime(2016, 11, 15, 10, 13, 12, tzinfo=&lt;StaticTzInfo &#39;GMT&#39;&gt;)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.date.unidate">
+<code class="descclassname">pyams_utils.date.</code><code class="descname">unidate</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.date.unidate" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get specified date converted to unicode ISO format</p>
+<p>Dates are always assumed to be stored in GMT timezone</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<a class="reference internal" href="#module-pyams_utils.date" title="pyams_utils.date"><em>date</em></a>) – input date to convert to unicode</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">unicode; input date converted to unicode</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">datetime</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.date</span> <span class="k">import</span> <span class="n">unidate</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">value</span> <span class="o">=</span> <span class="n">datetime</span><span class="p">(</span><span class="mi">2016</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">unidate</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+<span class="go">&#39;2016-11-15T10:13:12+00:00&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.decorator">
+<span id="pyams-utils-decorator-module"></span><h3>pyams_utils.decorator module<a class="headerlink" href="#module-pyams_utils.decorator" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.decorator.deprecated">
+<code class="descclassname">pyams_utils.decorator.</code><code class="descname">deprecated</code><span class="sig-paren">(</span><em>*msg</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.decorator.deprecated" title="Permalink to this definition">¶</a></dt>
+<dd><p>This is a decorator which can be used to mark functions as deprecated.</p>
+<p>It will result in a warning being emitted when the function is used.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.dict">
+<span id="pyams-utils-dict-module"></span><h3>pyams_utils.dict module<a class="headerlink" href="#module-pyams_utils.dict" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.dict.update_dict">
+<code class="descclassname">pyams_utils.dict.</code><code class="descname">update_dict</code><span class="sig-paren">(</span><em>input</em>, <em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.dict.update_dict" title="Permalink to this definition">¶</a></dt>
+<dd><p>Update given mapping if input value is a boolean ‘true’ value</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>input</strong> (<a class="reference internal" href="#module-pyams_utils.dict" title="pyams_utils.dict"><em>dict</em></a>) – input dictionary</li>
+<li><strong>key</strong> – mapping key</li>
+<li><strong>value</strong> – new value</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<p>‘False’ values leave mapping unchanged:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.dict</span> <span class="k">import</span> <span class="n">update_dict</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">mydict</span> <span class="o">=</span> <span class="p">{}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">update_dict</span><span class="p">(</span><span class="n">mydict</span><span class="p">,</span> <span class="s1">&#39;key1&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">mydict</span>
+</pre></div>
+</div>
+<p>{}
+&gt;&gt;&gt; update_dict(mydict, ‘key1’, ‘’)
+&gt;&gt;&gt; mydict
+{}
+&gt;&gt;&gt; update_dict(mydict, ‘key1’, 0)
+&gt;&gt;&gt; mydict
+{}</p>
+<p>‘True’ values modify the mapping:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">update_dict</span><span class="p">(</span><span class="n">mydict</span><span class="p">,</span> <span class="s1">&#39;key1&#39;</span><span class="p">,</span> <span class="s1">&#39;value&#39;</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">mydict</span>
+</pre></div>
+</div>
+<p>{‘key1’: ‘value’}
+&gt;&gt;&gt; update_dict(mydict, ‘key1’, ‘value2’)
+&gt;&gt;&gt; mydict
+{‘key1’: ‘value2’}</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.encoding">
+<span id="pyams-utils-encoding-module"></span><h3>pyams_utils.encoding module<a class="headerlink" href="#module-pyams_utils.encoding" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.encoding.EncodingField">
+<em class="property">class </em><code class="descclassname">pyams_utils.encoding.</code><code class="descname">EncodingField</code><span class="sig-paren">(</span><em>vocabulary='PyAMS encodings'</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.encoding.EncodingField" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.Choice</span></code></p>
+<p>Encoding schema field</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.encoding.EncodingsVocabulary">
+<em class="property">class </em><code class="descclassname">pyams_utils.encoding.</code><code class="descname">EncodingsVocabulary</code><span class="sig-paren">(</span><em>terms</em>, <em>*interfaces</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.encoding.EncodingsVocabulary" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.vocabulary.SimpleVocabulary</span></code></p>
+<p>A vocabulary containing a set of registered encodings</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.fanstatic">
+<span id="pyams-utils-fanstatic-module"></span><h3>pyams_utils.fanstatic module<a class="headerlink" href="#module-pyams_utils.fanstatic" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.fanstatic.ExternalResource">
+<em class="property">class </em><code class="descclassname">pyams_utils.fanstatic.</code><code class="descname">ExternalResource</code><span class="sig-paren">(</span><em>library</em>, <em>path</em>, <em>defer=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.fanstatic.ExternalResource" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">fanstatic.core.Resource</span></code></p>
+<p>Fanstatic external resource</p>
+<dl class="method">
+<dt id="pyams_utils.fanstatic.ExternalResource.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>library_url</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.fanstatic.ExternalResource.render" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.fanstatic.FanstaticTalesExtension">
+<em class="property">class </em><code class="descclassname">pyams_utils.fanstatic.</code><code class="descname">FanstaticTalesExtension</code><span class="sig-paren">(</span><em>context</em>, <em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.fanstatic.FanstaticTalesExtension" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextRequestViewAdapter" title="pyams_utils.adapter.ContextRequestViewAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextRequestViewAdapter</span></code></a></p>
+<p>extension:resource_path() TALES extension</p>
+<p>This TALES extension generates an URL matching a given Fanstatic resource.
+Resource is given as a string made of package name (in dotted form) followed by a colon and by the resource name.</p>
+<p>For example:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">html</span>
+</pre></div>
+</div>
+<blockquote>
+<div>&lt;div tal:attributes=”data-ams-plugin-pyams_content-src extension:resource_path(‘pyams_content.skin:pyams_content’)” /&gt;</div></blockquote>
+<dl class="method">
+<dt id="pyams_utils.fanstatic.FanstaticTalesExtension.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>resource</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.fanstatic.FanstaticTalesExtension.render" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.fanstatic.get_resource_path">
+<code class="descclassname">pyams_utils.fanstatic.</code><code class="descname">get_resource_path</code><span class="sig-paren">(</span><em>resource</em>, <em>signature='--static--'</em>, <em>versioning=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.fanstatic.get_resource_path" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get path for given resource</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.fanstatic.render_js">
+<code class="descclassname">pyams_utils.fanstatic.</code><code class="descname">render_js</code><span class="sig-paren">(</span><em>url</em>, <em>defer=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.fanstatic.render_js" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.html">
+<span id="pyams-utils-html-module"></span><h3>pyams_utils.html module<a class="headerlink" href="#module-pyams_utils.html" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.html.MyHTMLParser">
+<em class="property">class </em><code class="descclassname">pyams_utils.html.</code><code class="descname">MyHTMLParser</code><span class="sig-paren">(</span><em>*</em>, <em>convert_charrefs=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.html.MyHTMLParser" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">html.parser.HTMLParser</span></code></p>
+<p>HTML parser</p>
+<dl class="attribute">
+<dt id="pyams_utils.html.MyHTMLParser.charrefs">
+<code class="descname">charrefs</code><em class="property"> = {34: '&quot;', 38: '&amp;', 39: &quot;'&quot;, 60: '&lt;', 62: '&gt;', 192: 'À', 193: 'A', 194: 'Â', 195: 'A', 196: 'Ä', 197: 'A', 198: 'AE', 199: 'Ç', 200: 'È', 201: 'É', 202: 'Ê', 203: 'Ë', 204: 'I', 205: 'I', 206: 'Î', 207: 'Ï', 208: 'D', 209: 'N', 210: 'O', 211: 'O', 212: 'Ô', 213: 'O', 214: 'Ö', 215: 'x', 216: 'O', 217: 'Ù', 218: 'U', 219: 'Û', 220: 'Ü', 221: 'Y', 222: 'T', 223: 'sz', 224: 'à', 225: 'a', 226: 'â', 227: 'a', 228: 'ä', 229: 'a', 230: 'ae', 231: 'ç', 232: 'è', 233: 'é', 234: 'ê', 235: 'ë', 236: 'i', 237: 'i', 238: 'î', 239: 'ï', 240: 'e', 241: 'n', 242: 'o', 243: 'o', 244: 'ô', 245: 'o', 246: 'ö', 248: 'o', 249: 'ù', 250: 'u', 251: 'û', 252: 'ü', 253: 'y', 255: 'ÿ'}</em><a class="headerlink" href="#pyams_utils.html.MyHTMLParser.charrefs" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.html.MyHTMLParser.data">
+<code class="descname">data</code><em class="property"> = ''</em><a class="headerlink" href="#pyams_utils.html.MyHTMLParser.data" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.html.MyHTMLParser.entitydefs">
+<code class="descname">entitydefs</code><em class="property"> = {'Yacute': 'Y', 'otilde': 'o', 'icirc': 'î', 'oacute': 'o', 'aacute': 'a', 'egrave': 'è', 'nbsp': ' ', 'Ograve': 'O', 'lt': '&lt;', 'AElig': 'AE', 'iacute': 'i', 'Ucirc': 'Û', 'apos': &quot;'&quot;, 'Ocirc': 'Ô', 'Otilde': 'O', 'agrave': 'à', 'aring': 'a', 'Iacute': 'I', 'Iuml': 'I', 'ugrave': 'ù', 'Uacute': 'U', 'Ouml': 'Ö', 'Auml': 'Ä', 'atilde': 'a', 'ouml': 'ö', 'Ugrave': 'Ù', 'ecirc': 'ê', 'quot': '&quot;', 'iuml': 'ï', 'Uuml': 'Ü', 'Aring': 'A', 'amp': '&amp;', 'Oacute': 'O', 'ograve': 'o', 'ntilde': 'n', 'ucirc': 'û', 'oslash': 'o', 'THORN': 'T', 'ccedil': 'ç', 'ocirc': 'ô', 'thorn': 't', 'Acirc': 'Â', 'yacute': 'y', 'igrave': 'i', 'uacute': 'u', 'euml': 'ë', 'Aacute': 'A', 'yuml': 'ÿ', 'Euml': 'Ë', 'gt': '&gt;', 'Atilde': 'A', 'Igrave': 'I', 'Ntilde': 'N', 'Agrave': 'À', 'aelig': 'ae', 'eacute': 'é', 'Icirc': 'I', 'Oslash': 'O', 'Eacute': 'È', 'Ccedil': 'Ç', 'auml': 'ä', 'Egrave': 'É', 'Ecirc': 'Ê', 'uuml': 'ü', 'acirc': 'â'}</em><a class="headerlink" href="#pyams_utils.html.MyHTMLParser.entitydefs" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.html.MyHTMLParser.handle_charref">
+<code class="descname">handle_charref</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.html.MyHTMLParser.handle_charref" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.html.MyHTMLParser.handle_data">
+<code class="descname">handle_data</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.html.MyHTMLParser.handle_data" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.html.MyHTMLParser.handle_endtag">
+<code class="descname">handle_endtag</code><span class="sig-paren">(</span><em>tag</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.html.MyHTMLParser.handle_endtag" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.html.MyHTMLParser.handle_entityref">
+<code class="descname">handle_entityref</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.html.MyHTMLParser.handle_entityref" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.html.MyHTMLParser.handle_starttag">
+<code class="descname">handle_starttag</code><span class="sig-paren">(</span><em>tag</em>, <em>attrs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.html.MyHTMLParser.handle_starttag" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.html.html_to_text">
+<code class="descclassname">pyams_utils.html.</code><code class="descname">html_to_text</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.html.html_to_text" title="Permalink to this definition">¶</a></dt>
+<dd><p>Utility function to extract text content from HTML</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.html</span> <span class="k">import</span> <span class="n">html_to_text</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">html</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;&lt;p&gt;This is a HTML text part.&lt;/p&gt;&#39;&#39;&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">html_to_text</span><span class="p">(</span><span class="n">html</span><span class="p">)</span>
+<span class="go">&#39;This is a HTML text part.\n&#39;</span>
+</pre></div>
+</div>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">html</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;&lt;p&gt;This is text with french accents: &lt;strong&gt;é à è ù&lt;/strong&gt;&lt;/p&gt;&#39;&#39;&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">html_to_text</span><span class="p">(</span><span class="n">html</span><span class="p">)</span>
+<span class="go">&#39;This is text with french accents: é à è ù\n&#39;</span>
+</pre></div>
+</div>
+<p>HTML parser should handle entities correctly:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">html</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;&lt;div&gt;&lt;p&gt;Header&lt;/p&gt;&lt;p&gt;This is an &amp;lt; &amp;#242; &amp;gt; entity.&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&#39;&#39;&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">html_to_text</span><span class="p">(</span><span class="n">html</span><span class="p">)</span>
+<span class="go">&#39;Header\nThis is an &lt; ò &gt; entity.\n\n&#39;</span>
+</pre></div>
+</div>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">html</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;&lt;div&gt;&lt;p&gt;Header&lt;/p&gt;&lt;p&gt;This is an &amp;lt;&amp;nbsp;&amp;#242;&amp;nbsp;&amp;gt; entity.&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&#39;&#39;&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">html_to_text</span><span class="p">(</span><span class="n">html</span><span class="p">)</span>
+<span class="go">&#39;Header\nThis is an &lt; ò &gt; entity.\n\n&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.i18n">
+<span id="pyams-utils-i18n-module"></span><h3>pyams_utils.i18n module<a class="headerlink" href="#module-pyams_utils.i18n" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.i18n.get_browser_language">
+<code class="descclassname">pyams_utils.i18n.</code><code class="descname">get_browser_language</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.i18n.get_browser_language" title="Permalink to this definition">¶</a></dt>
+<dd><p>Custom locale negotiator</p>
+<p>Copied from zope.publisher code</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.i18n.normalize_lang">
+<code class="descclassname">pyams_utils.i18n.</code><code class="descname">normalize_lang</code><span class="sig-paren">(</span><em>lang</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.i18n.normalize_lang" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.include">
+<span id="pyams-utils-include-module"></span><h3>pyams_utils.include module<a class="headerlink" href="#module-pyams_utils.include" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.include.include_package">
+<code class="descclassname">pyams_utils.include.</code><code class="descname">include_package</code><span class="sig-paren">(</span><em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.include.include_package" title="Permalink to this definition">¶</a></dt>
+<dd><p>Pyramid package include</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.intids">
+<span id="pyams-utils-intids-module"></span><h3>pyams_utils.intids module<a class="headerlink" href="#module-pyams_utils.intids" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.intids.UniqueIdAdapter">
+<em class="property">class </em><code class="descclassname">pyams_utils.intids.</code><code class="descname">UniqueIdAdapter</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.intids.UniqueIdAdapter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextAdapter" title="pyams_utils.adapter.ContextAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextAdapter</span></code></a></p>
+<p>Object unique ID adapter</p>
+<p>This adapter is based on a registered IIntIds utility to get a unique ID
+for any persistent object.</p>
+<dl class="attribute">
+<dt id="pyams_utils.intids.UniqueIdAdapter.oid">
+<code class="descname">oid</code><a class="headerlink" href="#pyams_utils.intids.UniqueIdAdapter.oid" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get context ID in hexadecimal form</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.intids.handle_added_object">
+<code class="descclassname">pyams_utils.intids.</code><code class="descname">handle_added_object</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.intids.handle_added_object" title="Permalink to this definition">¶</a></dt>
+<dd><p>Notify IntId utility for added objects</p>
+<p>This subscriber is used for all persistent objects to be registered
+in all locally registered IIntIds utilities.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.intids.handle_intid_event">
+<code class="descclassname">pyams_utils.intids.</code><code class="descname">handle_intid_event</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.intids.handle_intid_event" title="Permalink to this definition">¶</a></dt>
+<dd><p>Event subscriber used to dispatch all IIntIdEvent events using Pyramid events subscribers to matching
+subscribers using Zope events</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.intids.handle_removed_object">
+<code class="descclassname">pyams_utils.intids.</code><code class="descname">handle_removed_object</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.intids.handle_removed_object" title="Permalink to this definition">¶</a></dt>
+<dd><p>Notify IntId utility for removed objects</p>
+<p>This subscriber is used for all persistent objects to be unregistered
+from all locally registered IIntIds utilities.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.list">
+<span id="pyams-utils-list-module"></span><h3>pyams_utils.list module<a class="headerlink" href="#module-pyams_utils.list" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.list.unique">
+<code class="descclassname">pyams_utils.list.</code><code class="descname">unique</code><span class="sig-paren">(</span><em>seq</em>, <em>idfun=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.list.unique" title="Permalink to this definition">¶</a></dt>
+<dd><p>Extract unique values from list, preserving order</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>seq</strong> (<em>iterator</em>) – input list</li>
+<li><strong>idfun</strong> (<em>callable</em>) – an identity function which is used to get ‘identity’ value of each element
+in the list</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">list; a new list containing only unique elements of the original list in their initial order.
+Original list is not modified.</p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.list</span> <span class="k">import</span> <span class="n">unique</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">mylist</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">unique</span><span class="p">(</span><span class="n">mylist</span><span class="p">)</span>
+<span class="go">[1, 2, 3]</span>
+</pre></div>
+</div>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">mylist</span> <span class="o">=</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">unique</span><span class="p">(</span><span class="n">mylist</span><span class="p">)</span>
+<span class="go">[3, 2, 1, 4]</span>
+</pre></div>
+</div>
+<p>You can also set an ‘id’ function applied on each element:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">mylist</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;2&#39;</span><span class="p">,</span> <span class="mi">4</span><span class="p">]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">unique</span><span class="p">(</span><span class="n">mylist</span><span class="p">,</span> <span class="n">idfun</span><span class="o">=</span><span class="nb">str</span><span class="p">)</span>
+<span class="go">[1, 2, 3, 4]</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.lock">
+<span id="pyams-utils-lock-module"></span><h3>pyams_utils.lock module<a class="headerlink" href="#module-pyams_utils.lock" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.lock.CacheLock">
+<em class="property">class </em><code class="descclassname">pyams_utils.lock.</code><code class="descname">CacheLock</code><span class="sig-paren">(</span><em>name</em>, <em>wait=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.lock.CacheLock" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Beaker based lock</p>
+<p>This lock can be used when you need to get a lot across several processes or even computers.
+The lock relies on a shared value stored into a shared Beaker cache.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>name</strong> (<em>str</em>) – name of the lock to use as shared key</li>
+<li><strong>wait</strong> (<em>boolean</em>) – if <em>False</em>, a <em>LockException</em> is raised if lock can’t be taken; otherwise,
+application waits until lock is released</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<p>Lock can be used as a context manager.</p>
+</dd></dl>
+
+<dl class="exception">
+<dt id="pyams_utils.lock.LockException">
+<em class="property">exception </em><code class="descclassname">pyams_utils.lock.</code><code class="descname">LockException</code><a class="headerlink" href="#pyams_utils.lock.LockException" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">Exception</span></code></p>
+<p>Cache lock exception</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.lock.get_locks_cache">
+<code class="descclassname">pyams_utils.lock.</code><code class="descname">get_locks_cache</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.lock.get_locks_cache" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get locks shared cache</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.lock.locked">
+<code class="descclassname">pyams_utils.lock.</code><code class="descname">locked</code><span class="sig-paren">(</span><em>name</em>, <em>wait=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.lock.locked" title="Permalink to this definition">¶</a></dt>
+<dd><p>Locked function decorator</p>
+<p>Can be used with any function or method which requires a global shared lock.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>name</strong> (<em>str</em>) – name of the lock to use as shared key</li>
+<li><strong>wait</strong> (<em>boolean</em>) – if <em>False</em>, a <em>LockException</em> is raised if lock can’t be taken; otherwise,
+application waits until lock is released</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.progress">
+<span id="pyams-utils-progress-module"></span><h3>pyams_utils.progress module<a class="headerlink" href="#module-pyams_utils.progress" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.progress.get_progress_cache">
+<code class="descclassname">pyams_utils.progress.</code><code class="descname">get_progress_cache</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.progress.get_progress_cache" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get cache storing tasks progress</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.progress.get_progress_status_view">
+<code class="descclassname">pyams_utils.progress.</code><code class="descname">get_progress_status_view</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.progress.get_progress_status_view" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get progress status of a given task</p>
+<p>Each submitted task is identified by an ID defined when the task is created</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.progress.get_running_tasks">
+<code class="descclassname">pyams_utils.progress.</code><code class="descname">get_running_tasks</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.progress.get_running_tasks" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get list of running tasks</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.progress.get_tasks_cache">
+<code class="descclassname">pyams_utils.progress.</code><code class="descname">get_tasks_cache</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.progress.get_tasks_cache" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get cache storing tasks list</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.progress.set_running_tasks">
+<code class="descclassname">pyams_utils.progress.</code><code class="descname">set_running_tasks</code><span class="sig-paren">(</span><em>tasks</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.progress.set_running_tasks" title="Permalink to this definition">¶</a></dt>
+<dd><p>Update list of running tasks</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.property">
+<span id="pyams-utils-property-module"></span><h3>pyams_utils.property module<a class="headerlink" href="#module-pyams_utils.property" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.property.DocFieldProperty">
+<em class="property">class </em><code class="descclassname">pyams_utils.property.</code><code class="descname">DocFieldProperty</code><span class="sig-paren">(</span><em>field</em>, <em>name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.DocFieldProperty" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.fieldproperty.FieldProperty</span></code></p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.property.cached">
+<em class="property">class </em><code class="descclassname">pyams_utils.property.</code><code class="descname">cached</code><span class="sig-paren">(</span><em>function</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.cached" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Custom property decorator to define a property or function which is calculated only once</p>
+<p>When applied on a function, caching is based on input arguments</p>
+<dl class="method">
+<dt id="pyams_utils.property.cached.expire">
+<code class="descname">expire</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.cached.expire" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.property.cached_property">
+<em class="property">class </em><code class="descclassname">pyams_utils.property.</code><code class="descname">cached_property</code><span class="sig-paren">(</span><em>fget</em>, <em>doc=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.cached_property" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>A read-only property decorator that is only evaluated once.</p>
+<p>The value is cached on the object itself rather than the function or class; this should prevent
+memory leakage.</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.property.classproperty">
+<em class="property">class </em><code class="descclassname">pyams_utils.property.</code><code class="descname">classproperty</code><span class="sig-paren">(</span><em>fget=None</em>, <em>fset=None</em>, <em>fdel=None</em>, <em>doc=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.classproperty" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Same decorator as property(), but passes obj.__class__ instead of obj to fget/fset/fdel.</p>
+<p>Original code for property emulation:
+<a class="reference external" href="https://docs.python.org/3.5/howto/descriptor.html#properties">https://docs.python.org/3.5/howto/descriptor.html#properties</a></p>
+<dl class="method">
+<dt id="pyams_utils.property.classproperty.deleter">
+<code class="descname">deleter</code><span class="sig-paren">(</span><em>fdel</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.classproperty.deleter" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.property.classproperty.getter">
+<code class="descname">getter</code><span class="sig-paren">(</span><em>fget</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.classproperty.getter" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.property.classproperty.setter">
+<code class="descname">setter</code><span class="sig-paren">(</span><em>fset</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.classproperty.setter" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.property.classproperty_support">
+<code class="descclassname">pyams_utils.property.</code><code class="descname">classproperty_support</code><span class="sig-paren">(</span><em>cls</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.property.classproperty_support" title="Permalink to this definition">¶</a></dt>
+<dd><p>Class decorator to add metaclass to a class.</p>
+<p>Metaclass uses to add descriptors to class attributes</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.registry">
+<span id="pyams-utils-registry-module"></span><h3>pyams_utils.registry module<a class="headerlink" href="#module-pyams_utils.registry" title="Permalink to this headline">¶</a></h3>
+<p>Local registry management package</p>
+<p>This package is used to manage <em>local registry</em>. A local registry is a <em>site management</em> component
+created automatically on application startup by PyAMS_utils package. It can be used to store and register
+components, mainly utilities which are created and configured dynamically by a site administrator; this can include
+SQLAlchemy engines, ZEO connections, and several PyAMS utilities like security manager, medias converter,
+tasks scheduler and many other ones.</p>
+<p>See <a class="reference internal" href="zca.html#zca"><span class="std std-ref">Managing ZCA with PyAMS</span></a> to get a brief introduction about using a local registry with PyAMS packages.</p>
+<dl class="class">
+<dt id="pyams_utils.registry.LocalRegistry">
+<em class="property">class </em><code class="descclassname">pyams_utils.registry.</code><code class="descname">LocalRegistry</code><a class="headerlink" href="#pyams_utils.registry.LocalRegistry" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">_thread._local</span></code></p>
+<p>Local registry</p>
+<dl class="method">
+<dt id="pyams_utils.registry.LocalRegistry.get_registry">
+<code class="descname">get_registry</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.LocalRegistry.get_registry" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.registry.LocalRegistry.set_registry">
+<code class="descname">set_registry</code><span class="sig-paren">(</span><em>registry</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.LocalRegistry.set_registry" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.get_all_utilities_registered_for">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">get_all_utilities_registered_for</code><span class="sig-paren">(</span><em>interface</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.get_all_utilities_registered_for" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get list of registered utilities for given interface</p>
+<p>Do a registry lookup for matching utilities into local registry first, then on each registry
+associated with current thread stack.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.get_current_registry">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">get_current_registry</code><span class="sig-paren">(</span><em>context=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.get_current_registry" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get current or global registry</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.get_global_registry">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">get_global_registry</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.get_global_registry" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get global registry</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.get_local_registry">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">get_local_registry</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.get_local_registry" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get local registry</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.get_registries">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">get_registries</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.get_registries" title="Permalink to this definition">¶</a></dt>
+<dd><p>Iterator on components registries</p>
+<p>Returns an iterator on current local registry (if any) and registries associated
+in current thread stack.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.get_utilities_for">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">get_utilities_for</code><span class="sig-paren">(</span><em>interface</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.get_utilities_for" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get utilities registered with given interface as (name, util) tuples iterator</p>
+<p>Do a registry lookup for matching utilities into local registry first, then on each registry
+associated with current thread stack.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.get_utility">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">get_utility</code><span class="sig-paren">(</span><em>provided</em>, <em>name=''</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.get_utility" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get utility registered with given interface</p>
+<p>Do a registry lookup for given utility into local registry first, then on each registry
+associated with current thread stack.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>provided</strong> (<em>Interface</em>) – the requested interface</li>
+<li><strong>name</strong> (<em>str</em>) – name of the requested utility</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">object; the requested object. A <em>ComponentLookupError</em> is raised if the utility
+can’t be found.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.handle_new_request">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">handle_new_request</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.handle_new_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>New request event subscriber</p>
+<p>Is used to initialize local registry to None for any new request</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.handle_site_before_traverse">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">handle_site_before_traverse</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.handle_site_before_traverse" title="Permalink to this definition">¶</a></dt>
+<dd><p>Before traverse event subscriber</p>
+<p>Define site’s local registry when an object implementing ISite is traversed</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.query_utility">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">query_utility</code><span class="sig-paren">(</span><em>provided</em>, <em>name=''</em>, <em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.query_utility" title="Permalink to this definition">¶</a></dt>
+<dd><p>Query utility registered with given interface</p>
+<p>Do a registry lookup for given utility into local registry first, then on each registry
+associated with current thread stack.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>provided</strong> (<em>Interface</em>) – the requested interface</li>
+<li><strong>name</strong> (<em>str</em>) – name of the requested utility</li>
+<li><strong>default</strong> (<em>object</em>) – the default object returned if the requested utility can’t be found</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">object; the requested object, or <em>default</em> if it can’t be found</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.registered_utilities">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">registered_utilities</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.registered_utilities" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get utilities registrations as generator</p>
+<p>Iterates over utilities defined in all registries, starting with local ones.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.registry.set_local_registry">
+<code class="descclassname">pyams_utils.registry.</code><code class="descname">set_local_registry</code><span class="sig-paren">(</span><em>registry</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.set_local_registry" title="Permalink to this definition">¶</a></dt>
+<dd><p>Define local registry</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.registry.utility_config">
+<em class="property">class </em><code class="descclassname">pyams_utils.registry.</code><code class="descname">utility_config</code><span class="sig-paren">(</span><em>**settings</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.registry.utility_config" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Function or class decorator to register a utility in the global registry</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>name</strong> (<em>str</em>) – default=’‘; name under which the utility is registered</li>
+<li><strong>provides</strong> (<em>Interface</em>) – the interface for which the utility is registered</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<p>Please note that a single utility can be registered several times (using several annotations).</p>
+<dl class="attribute">
+<dt id="pyams_utils.registry.utility_config.venusian">
+<code class="descname">venusian</code><em class="property"> = &lt;module 'venusian' from '/var/local/env/pyams/eggs/venusian-1.1.0-py3.5.egg/venusian/__init__.py'&gt;</em><a class="headerlink" href="#pyams_utils.registry.utility_config.venusian" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.request">
+<span id="pyams-utils-request-module"></span><h3>pyams_utils.request module<a class="headerlink" href="#module-pyams_utils.request" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.request.PyAMSRequest">
+<em class="property">class </em><code class="descclassname">pyams_utils.request.</code><code class="descname">PyAMSRequest</code><span class="sig-paren">(</span><em>environ</em>, <em>charset=None</em>, <em>unicode_errors=None</em>, <em>decode_param_names=None</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.PyAMSRequest" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">pyramid.request.Request</span></code></p>
+<p>Custom request factory</p>
+<p>Used to add ‘context’ argument to ‘effective_principals’ method call
+to be able to get ‘roles’ principals</p>
+<dl class="method">
+<dt id="pyams_utils.request.PyAMSRequest.has_permission">
+<code class="descname">has_permission</code><span class="sig-paren">(</span><em>x</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.PyAMSRequest.has_permission" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.request.check_request">
+<code class="descclassname">pyams_utils.request.</code><code class="descname">check_request</code><span class="sig-paren">(</span><em>path='/'</em>, <em>environ=None</em>, <em>base_url=None</em>, <em>headers=None</em>, <em>POST=None</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.check_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get current request, or create a new blank one if missing</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.request.get_annotations">
+<code class="descclassname">pyams_utils.request.</code><code class="descname">get_annotations</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.get_annotations" title="Permalink to this definition">¶</a></dt>
+<dd><p>Define ‘annotations’ request property</p>
+<p>This function is automatically defined as a custom request method on package include.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.request.get_debug">
+<code class="descclassname">pyams_utils.request.</code><code class="descname">get_debug</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.get_debug" title="Permalink to this definition">¶</a></dt>
+<dd><p>Define ‘debug’ request property</p>
+<p>This function is automatically defined as a custom request method on package include.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.request.get_request">
+<code class="descclassname">pyams_utils.request.</code><code class="descname">get_request</code><span class="sig-paren">(</span><em>raise_exception=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.get_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get current request</p>
+<p>Raises a NoInteraction exception if there is no active request.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.request.get_request_data">
+<code class="descclassname">pyams_utils.request.</code><code class="descname">get_request_data</code><span class="sig-paren">(</span><em>request</em>, <em>key</em>, <em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.get_request_data" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get data associated with request</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>request</strong> – the request containing requested data</li>
+<li><strong>key</strong> (<em>str</em>) – request data annotation key</li>
+<li><strong>default</strong> (<em>object</em>) – the default value when data is missing</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the requested value, or <em>default</em></p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.request.query_request">
+<code class="descclassname">pyams_utils.request.</code><code class="descname">query_request</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.query_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Query current request</p>
+<p>Returns None if there is no active request</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.request.request_property">
+<code class="descclassname">pyams_utils.request.</code><code class="descname">request_property</code><span class="sig-paren">(</span><em>key=None</em>, <em>prefix=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.request_property" title="Permalink to this definition">¶</a></dt>
+<dd><p>Define a method decorator used to store result into current request’s annotations</p>
+<p>If no request is currently running, a new one is created.
+<cite>key</cite> is a required argument; if None, the key will be the method’s object</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>key</strong> (<em>str</em>) – annotations value key; if <em>None</em>, the key will be the method’s object; if <em>key</em> is a callable
+object, it will be called to get the actual session key</li>
+<li><strong>prefix</strong> – str; prefix to use for session key; if <em>None</em>, the prefix will be the property name</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.request.set_request_data">
+<code class="descclassname">pyams_utils.request.</code><code class="descname">set_request_data</code><span class="sig-paren">(</span><em>request</em>, <em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.request.set_request_data" title="Permalink to this definition">¶</a></dt>
+<dd><p>Associate data with request</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>request</strong> – the request in which to set data</li>
+<li><strong>key</strong> (<em>str</em>) – request data annotation key</li>
+<li><strong>value</strong> (<em>object</em>) – the value to be set in request annotation</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.schema">
+<span id="pyams-utils-schema-module"></span><h3>pyams_utils.schema module<a class="headerlink" href="#module-pyams_utils.schema" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.schema.ColorField">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">ColorField</code><span class="sig-paren">(</span><em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.ColorField" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapfields.TextLine</span></code></p>
+<p>Color field</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.schema.DatesRangeField">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">DatesRangeField</code><span class="sig-paren">(</span><em>value_type=None</em>, <em>unique=False</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.DatesRangeField" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.Tuple</span></code></p>
+<p>Dates range field</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.schema.DottedDecimalField">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">DottedDecimalField</code><span class="sig-paren">(</span><em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.DottedDecimalField" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.Decimal</span></code></p>
+<p>Dotted decimal field</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.schema.EncodedPassword">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">EncodedPassword</code><span class="sig-paren">(</span><em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.EncodedPassword" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapfields.Password</span></code></p>
+<p>Encoded password field</p>
+<dl class="method">
+<dt id="pyams_utils.schema.EncodedPassword.constraint">
+<code class="descname">constraint</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.EncodedPassword.constraint" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.schema.EncodedPassword.fromUnicode">
+<code class="descname">fromUnicode</code><span class="sig-paren">(</span><em>str</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.EncodedPassword.fromUnicode" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.schema.HTMLField">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">HTMLField</code><span class="sig-paren">(</span><em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.HTMLField" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapfields.Text</span></code></p>
+<p>HTML field</p>
+</dd></dl>
+
+<dl class="exception">
+<dt id="pyams_utils.schema.InvalidEmail">
+<em class="property">exception </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">InvalidEmail</code><a class="headerlink" href="#pyams_utils.schema.InvalidEmail" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapinterfaces.ValidationError</span></code></p>
+<p>Email address must be entered as « <a class="reference external" href="mailto:name&#37;&#52;&#48;domain&#46;name">name<span>&#64;</span>domain<span>&#46;</span>name</a> », without ‘&lt;’ and ‘&gt;’ characters</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.schema.MailAddressField">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">MailAddressField</code><span class="sig-paren">(</span><em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.MailAddressField" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapfields.TextLine</span></code></p>
+<p>Mail address field</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.schema.PersistentDict">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">PersistentDict</code><span class="sig-paren">(</span><em>key_type=None</em>, <em>value_type=None</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.PersistentDict" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.Dict</span></code></p>
+<p>Persistent mapping field</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.schema.PersistentList">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">PersistentList</code><span class="sig-paren">(</span><em>value_type=None</em>, <em>unique=False</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.PersistentList" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.List</span></code></p>
+<p>Persistent list field</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.schema.TextLineListField">
+<em class="property">class </em><code class="descclassname">pyams_utils.schema.</code><code class="descname">TextLineListField</code><span class="sig-paren">(</span><em>value_type=None</em>, <em>unique=False</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.schema.TextLineListField" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.List</span></code></p>
+<p>TextLine list field</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.session">
+<span id="pyams-utils-session-module"></span><h3>pyams_utils.session module<a class="headerlink" href="#module-pyams_utils.session" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.session.get_session_data">
+<code class="descclassname">pyams_utils.session.</code><code class="descname">get_session_data</code><span class="sig-paren">(</span><em>request</em>, <em>app</em>, <em>key</em>, <em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.session.get_session_data" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get data associated with current user session</p>
+<p>PyAMS session management is based on <code class="xref py py-mod docutils literal"><span class="pre">Beaker</span></code> package session management.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>request</strong> – the request from which session is extracted</li>
+<li><strong>app</strong> (<em>str</em>) – application name</li>
+<li><strong>key</strong> (<em>str</em>) – session data key for given application</li>
+<li><strong>default</strong> – object; requested session data, or <em>default</em> if it can’t be found</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">APPLICATION_KEY</span> <span class="o">=</span> <span class="s1">&#39;MyApp&#39;</span>
+<span class="n">SESSION_KEY</span> <span class="o">=</span> <span class="s1">&#39;MyFunction&#39;</span>
+
+<span class="k">def</span> <span class="nf">my_function</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
+    <span class="k">return</span> <span class="n">get_session_data</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">APPLICATION_KEY</span><span class="p">,</span> <span class="n">SESSION_KEY</span><span class="p">)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.session.session_property">
+<code class="descclassname">pyams_utils.session.</code><code class="descname">session_property</code><span class="sig-paren">(</span><em>app</em>, <em>key=None</em>, <em>prefix=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.session.session_property" title="Permalink to this definition">¶</a></dt>
+<dd><p>Define a method decorator used to store result into request’s session</p>
+<p>If no request is currently running, a new one is created.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>app</strong> (<em>str</em>) – application identifier used to prefix session keys</li>
+<li><strong>key</strong> (<em>str</em>) – session’s value key; if <em>None</em>, the key will be the method’s object; if <em>key</em> is a callable
+object, il will be called to get the actual session key</li>
+<li><strong>prefix</strong> – str; prefix to use for session key; if <em>None</em>, the prefix will be the property name</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.session.set_session_data">
+<code class="descclassname">pyams_utils.session.</code><code class="descname">set_session_data</code><span class="sig-paren">(</span><em>request</em>, <em>app</em>, <em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.session.set_session_data" title="Permalink to this definition">¶</a></dt>
+<dd><p>Associate data with current user session</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>request</strong> – the request from which session is extracted</li>
+<li><strong>app</strong> (<em>str</em>) – application name</li>
+<li><strong>key</strong> (<em>str</em>) – session data key for given application</li>
+<li><strong>value</strong> (<em>object</em>) – any object that can be pickled can be stored into user session</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">APPLICATION_KEY</span> <span class="o">=</span> <span class="s1">&#39;MyApp&#39;</span>
+<span class="n">SESSION_KEY</span> <span class="o">=</span> <span class="s1">&#39;MyFunction&#39;</span>
+
+<span class="k">def</span> <span class="nf">my_function</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
+    <span class="n">value</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;key1&#39;</span><span class="p">:</span> <span class="s1">&#39;value1&#39;</span><span class="p">,</span> <span class="s1">&#39;key2&#39;</span><span class="p">:</span> <span class="s1">&#39;value2&#39;</span><span class="p">}</span>
+    <span class="n">set_session_data</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">APPLICATION_KEY</span><span class="p">,</span> <span class="n">SESSION_KEY</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.site">
+<span id="pyams-utils-site-module"></span><h3>pyams_utils.site module<a class="headerlink" href="#module-pyams_utils.site" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.site.BaseSiteRoot">
+<em class="property">class </em><code class="descclassname">pyams_utils.site.</code><code class="descname">BaseSiteRoot</code><a class="headerlink" href="#pyams_utils.site.BaseSiteRoot" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.container.folder.Folder</span></code>, <code class="xref py py-class docutils literal"><span class="pre">zope.site.site.SiteManagerContainer</span></code></p>
+<p>Default site root</p>
+<p>A site root can be used as base application root in your ZODB.
+It’s also site root responsibility to manage your local site manager.</p>
+<p>BaseSiteRoot defines a basic ACL which gives all permissions to system administrator.</p>
+<dl class="attribute">
+<dt id="pyams_utils.site.BaseSiteRoot.config_klass">
+<code class="descname">config_klass</code><em class="property"> = None</em><a class="headerlink" href="#pyams_utils.site.BaseSiteRoot.config_klass" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.site.NewLocalSiteCreatedEvent">
+<em class="property">class </em><code class="descclassname">pyams_utils.site.</code><code class="descname">NewLocalSiteCreatedEvent</code><span class="sig-paren">(</span><em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.site.NewLocalSiteCreatedEvent" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.interface.interfaces.ObjectEvent</span></code></p>
+<p>New local site creation event</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.site.SiteRootEtcTraverser">
+<em class="property">class </em><code class="descclassname">pyams_utils.site.</code><code class="descname">SiteRootEtcTraverser</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.site.SiteRootEtcTraverser" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextAdapter" title="pyams_utils.adapter.ContextAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextAdapter</span></code></a></p>
+<p>Site root ++etc++ namespace traverser</p>
+<p>Gives access to local site manager from <em>/++etc++site</em> URL</p>
+<dl class="method">
+<dt id="pyams_utils.site.SiteRootEtcTraverser.traverse">
+<code class="descname">traverse</code><span class="sig-paren">(</span><em>name</em>, <em>furtherpath=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.site.SiteRootEtcTraverser.traverse" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.site.SiteUpgradeEvent">
+<em class="property">class </em><code class="descclassname">pyams_utils.site.</code><code class="descname">SiteUpgradeEvent</code><span class="sig-paren">(</span><em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.site.SiteUpgradeEvent" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.interface.interfaces.ObjectEvent</span></code></p>
+<p>Site upgrade request event</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.site.check_required_utilities">
+<code class="descclassname">pyams_utils.site.</code><code class="descname">check_required_utilities</code><span class="sig-paren">(</span><em>site</em>, <em>utilities</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.site.check_required_utilities" title="Permalink to this definition">¶</a></dt>
+<dd><p>Utility function to check for required utilities</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>site</strong> (<em>object</em>) – the site manager into which configuration may be checked</li>
+<li><strong>utilities</strong> (<em>tuple</em>) – each element of the tuple is another tuple made of the utility interface,
+the utility registration name, the utility factory and the object name when creating the utility, as in:</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">REQUIRED_UTILITIES</span> <span class="o">=</span> <span class="p">((</span><span class="n">ISecurityManager</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="n">SecurityManager</span><span class="p">,</span> <span class="s1">&#39;Security manager&#39;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="n">IPrincipalAnnotationUtility</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="n">PrincipalAnnotationUtility</span><span class="p">,</span> <span class="s1">&#39;User profiles&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.site.site_factory">
+<code class="descclassname">pyams_utils.site.</code><code class="descname">site_factory</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.site.site_factory" title="Permalink to this definition">¶</a></dt>
+<dd><p>Application site factory</p>
+<p>On application startup, this factory checks configuration to get application name and
+load it from the ZODB; if the application can’t be found, configuration is scanned to
+get application factory, create a new one and create a local site manager.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.site.site_upgrade">
+<code class="descclassname">pyams_utils.site.</code><code class="descname">site_upgrade</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.site.site_upgrade" title="Permalink to this definition">¶</a></dt>
+<dd><p>Upgrade site when needed</p>
+<p>This function is executed by <em>pyams_upgrade</em> console script.
+Site generations are registered named utilities providing
+<code class="xref py py-class docutils literal"><span class="pre">ISiteGenerations</span></code> interface.</p>
+<p>Current site generations are stored into annotations for each generation adapter.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.size">
+<span id="pyams-utils-size-module"></span><h3>pyams_utils.size module<a class="headerlink" href="#module-pyams_utils.size" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.size.get_human_size">
+<code class="descclassname">pyams_utils.size.</code><code class="descname">get_human_size</code><span class="sig-paren">(</span><em>value</em>, <em>request=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.size.get_human_size" title="Permalink to this definition">¶</a></dt>
+<dd><p>Convert given bytes value in human readable format</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyramid.testing</span> <span class="k">import</span> <span class="n">DummyRequest</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">request</span> <span class="o">=</span> <span class="n">DummyRequest</span><span class="p">(</span><span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;_LOCALE_&#39;</span><span class="p">:</span> <span class="s1">&#39;en&#39;</span><span class="p">})</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">request</span><span class="o">.</span><span class="n">locale_name</span>
+<span class="go">&#39;en&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.size</span> <span class="k">import</span> <span class="n">get_human_size</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_human_size</span><span class="p">(</span><span class="mi">256</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;256 bytes&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_human_size</span><span class="p">(</span><span class="mi">3678</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;3.6 Kb&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_human_size</span><span class="p">(</span><span class="mi">6785342</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;6.47 Mb&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_human_size</span><span class="p">(</span><span class="mi">3674815342</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;3.422 Gb&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">request</span> <span class="o">=</span> <span class="n">DummyRequest</span><span class="p">(</span><span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;_LOCALE_&#39;</span><span class="p">:</span> <span class="s1">&#39;fr&#39;</span><span class="p">})</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">request</span><span class="o">.</span><span class="n">locale_name</span>
+<span class="go">&#39;fr&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_human_size</span><span class="p">(</span><span class="mi">256</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;256 bytes&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_human_size</span><span class="p">(</span><span class="mi">3678</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;3,6 Kb&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_human_size</span><span class="p">(</span><span class="mi">6785342</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;6,47 Mb&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_human_size</span><span class="p">(</span><span class="mi">3674815342</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
+<span class="go">&#39;3,422 Gb&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.tales">
+<span id="pyams-utils-tales-module"></span><h3>pyams_utils.tales module<a class="headerlink" href="#module-pyams_utils.tales" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.tales.ContextExprMixin">
+<em class="property">class </em><code class="descclassname">pyams_utils.tales.</code><code class="descname">ContextExprMixin</code><a class="headerlink" href="#pyams_utils.tales.ContextExprMixin" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Mixin-class for expression compilers</p>
+<dl class="attribute">
+<dt id="pyams_utils.tales.ContextExprMixin.transform">
+<code class="descname">transform</code><em class="property"> = None</em><a class="headerlink" href="#pyams_utils.tales.ContextExprMixin.transform" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.tales.ExtensionExpr">
+<em class="property">class </em><code class="descclassname">pyams_utils.tales.</code><code class="descname">ExtensionExpr</code><span class="sig-paren">(</span><em>expression</em>, <em>braces_required=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.tales.ExtensionExpr" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.tales.ContextExprMixin" title="pyams_utils.tales.ContextExprMixin"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.tales.ContextExprMixin</span></code></a>, <code class="xref py py-class docutils literal"><span class="pre">chameleon.tales.StringExpr</span></code></p>
+<p>extension: TALES expression</p>
+<p>This expression can be used to call a custom named adapter providing ITALESExtension interface.</p>
+<dl class="attribute">
+<dt id="pyams_utils.tales.ExtensionExpr.transform">
+<code class="descname">transform</code><em class="property"> = &lt;Symbol value=&lt;function render_extension&gt; at 7f1fadbcfa20&gt;</em><a class="headerlink" href="#pyams_utils.tales.ExtensionExpr.transform" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.tales.render_extension">
+<code class="descclassname">pyams_utils.tales.</code><code class="descname">render_extension</code><span class="sig-paren">(</span><em>econtext</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.tales.render_extension" title="Permalink to this definition">¶</a></dt>
+<dd><p>TALES extension renderer</p>
+<p>See <a class="reference internal" href="tales.html#tales"><span class="std std-ref">Custom TALES extensions</span></a> for complete description.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.text">
+<span id="pyams-utils-text-module"></span><h3>pyams_utils.text module<a class="headerlink" href="#module-pyams_utils.text" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.text.BaseHTMLRenderer">
+<em class="property">class </em><code class="descclassname">pyams_utils.text.</code><code class="descname">BaseHTMLRenderer</code><span class="sig-paren">(</span><em>context</em>, <em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.BaseHTMLRenderer" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Raw text HTML renderer</p>
+<p>This renderer renders input text ‘as is’, mainly for use in a &lt;pre&gt; tag.</p>
+<dl class="method">
+<dt id="pyams_utils.text.BaseHTMLRenderer.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.BaseHTMLRenderer.render" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.text.HTMLTalesExtension">
+<em class="property">class </em><code class="descclassname">pyams_utils.text.</code><code class="descname">HTMLTalesExtension</code><span class="sig-paren">(</span><em>context</em>, <em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.HTMLTalesExtension" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextRequestViewAdapter" title="pyams_utils.adapter.ContextRequestViewAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextRequestViewAdapter</span></code></a></p>
+<p><em>extension:html</em> TALES expression</p>
+<p>If first <em>context</em> argument of the renderer is an object for which an <code class="xref py py-class docutils literal"><span class="pre">IHTMLRenderer</span></code>
+adapter can be found, this adapter is used to render the context to HTML; if <em>context</em> is a string,
+it is converted to HTML using the renderer defined as second parameter; otherwise, context is just
+converted to string using the <code class="xref py py-func docutils literal"><span class="pre">str()</span></code> function.</p>
+<dl class="method">
+<dt id="pyams_utils.text.HTMLTalesExtension.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>context=None</em>, <em>renderer='text'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.HTMLTalesExtension.render" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.text.ReStructuredTextRenderer">
+<em class="property">class </em><code class="descclassname">pyams_utils.text.</code><code class="descname">ReStructuredTextRenderer</code><span class="sig-paren">(</span><em>context</em>, <em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.ReStructuredTextRenderer" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.text.BaseHTMLRenderer" title="pyams_utils.text.BaseHTMLRenderer"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.text.BaseHTMLRenderer</span></code></a></p>
+<p>reStructuredText HTML renderer</p>
+<p>This renderer is using <em>docutils</em> to render HTML output.</p>
+<dl class="method">
+<dt id="pyams_utils.text.ReStructuredTextRenderer.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.ReStructuredTextRenderer.render" title="Permalink to this definition">¶</a></dt>
+<dd><p>Render reStructuredText to HTML</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.text.RenderersVocabulary">
+<em class="property">class </em><code class="descclassname">pyams_utils.text.</code><code class="descname">RenderersVocabulary</code><a class="headerlink" href="#pyams_utils.text.RenderersVocabulary" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.vocabulary.SimpleVocabulary</span></code></p>
+<p>Text renderers vocabulary</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.text.TextRenderer">
+<em class="property">class </em><code class="descclassname">pyams_utils.text.</code><code class="descname">TextRenderer</code><span class="sig-paren">(</span><em>context</em>, <em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.TextRenderer" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.text.BaseHTMLRenderer" title="pyams_utils.text.BaseHTMLRenderer"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.text.BaseHTMLRenderer</span></code></a></p>
+<p>Basic text HTML renderer</p>
+<p>This renderer only replace newlines with HTML breaks.</p>
+<dl class="method">
+<dt id="pyams_utils.text.TextRenderer.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.TextRenderer.render" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.text.get_text_start">
+<code class="descclassname">pyams_utils.text.</code><code class="descname">get_text_start</code><span class="sig-paren">(</span><em>text</em>, <em>length</em>, <em>max=0</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.get_text_start" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get first words of given text with maximum given length</p>
+<p>If <em>max</em> is specified, text is shortened only if remaining text is longer this value</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>text</strong> (<em>str</em>) – initial text</li>
+<li><strong>length</strong> (<em>integer</em>) – maximum length of resulting text</li>
+<li><strong>max</strong> (<em>integer</em>) – if &gt; 0, <em>text</em> is shortened only if remaining text is longer than max</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.text</span> <span class="k">import</span> <span class="n">get_text_start</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_text_start</span><span class="p">(</span><span class="s1">&#39;This is a long string&#39;</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+<span class="go">&#39;This is a&amp;#133;&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_text_start</span><span class="p">(</span><span class="s1">&#39;This is a long string&#39;</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+<span class="go">&#39;This is a long&amp;#133;&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_text_start</span><span class="p">(</span><span class="s1">&#39;This is a long string&#39;</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">7</span><span class="p">)</span>
+<span class="go">&#39;This is a long string&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.text.text_to_html">
+<code class="descclassname">pyams_utils.text.</code><code class="descname">text_to_html</code><span class="sig-paren">(</span><em>text</em>, <em>renderer='text'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.text.text_to_html" title="Permalink to this definition">¶</a></dt>
+<dd><p>Convert text to HTML using the given renderer</p>
+<p>Renderer name can be any registered HTML renderer adapter</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.traversing">
+<span id="pyams-utils-traversing-module"></span><h3>pyams_utils.traversing module<a class="headerlink" href="#module-pyams_utils.traversing" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.traversing.NamespaceTraverser">
+<em class="property">class </em><code class="descclassname">pyams_utils.traversing.</code><code class="descname">NamespaceTraverser</code><span class="sig-paren">(</span><em>root</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.traversing.NamespaceTraverser" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">pyramid.traversal.ResourceTreeTraverser</span></code></p>
+<p>Custom traverser handling views and namespaces</p>
+<p>This is an upgraded version of native Pyramid traverser.
+It adds:
+- a new BeforeTraverseEvent before traversing each object in the path
+- support for namespaces with “++” notation</p>
+<dl class="attribute">
+<dt id="pyams_utils.traversing.NamespaceTraverser.NAMESPACE_SELECTOR">
+<code class="descname">NAMESPACE_SELECTOR</code><em class="property"> = '++'</em><a class="headerlink" href="#pyams_utils.traversing.NamespaceTraverser.NAMESPACE_SELECTOR" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.traversing.PathElementsAdapter">
+<em class="property">class </em><code class="descclassname">pyams_utils.traversing.</code><code class="descname">PathElementsAdapter</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.traversing.PathElementsAdapter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextAdapter" title="pyams_utils.adapter.ContextAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextAdapter</span></code></a></p>
+<p>Contained object path elements adapter</p>
+<p>This interface is intended to be used inside a keyword index to
+be able to search object based on a given parent</p>
+<dl class="attribute">
+<dt id="pyams_utils.traversing.PathElementsAdapter.parents">
+<code class="descname">parents</code><a class="headerlink" href="#pyams_utils.traversing.PathElementsAdapter.parents" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.traversing.get_parent">
+<code class="descclassname">pyams_utils.traversing.</code><code class="descname">get_parent</code><span class="sig-paren">(</span><em>context</em>, <em>interface=&lt;InterfaceClass zope.interface.Interface&gt;</em>, <em>allow_context=True</em>, <em>condition=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.traversing.get_parent" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get first parent of the context that implements given interface</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>context</strong> (<em>object</em>) – base element</li>
+<li><strong>interface</strong> (<em>Interface</em>) – the interface that parend should implement</li>
+<li><strong>allow_context</strong> (<em>boolean</em>) – if ‘True’ (the default), traversing is done starting with context; otherwise,
+traversing is done starting from context’s parent</li>
+<li><strong>condition</strong> (<em>callable</em>) – an optional function that should return a ‘True’ result when called with parent
+as first argument</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.unicode">
+<span id="pyams-utils-unicode-module"></span><h3>pyams_utils.unicode module<a class="headerlink" href="#module-pyams_utils.unicode" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.unicode.decode">
+<code class="descclassname">pyams_utils.unicode.</code><code class="descname">decode</code><span class="sig-paren">(</span><em>value</em>, <em>encoding='utf-8'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.unicode.decode" title="Permalink to this definition">¶</a></dt>
+<dd><p>Decode given bytes value to unicode with given encoding</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>value</strong> (<em>bytes</em>) – the value to decode</li>
+<li><strong>encoding</strong> (<em>str</em>) – selected encoding</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">str; value decoded to unicode string if input is a bytes, original value otherwise</p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.unicode</span> <span class="k">import</span> <span class="n">decode</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">decode</span><span class="p">(</span><span class="sa">b</span><span class="s1">&#39;Cha</span><span class="se">\xc3\xae</span><span class="s1">ne accentu</span><span class="se">\xc3\xa9</span><span class="s1">e&#39;</span><span class="p">)</span>
+<span class="go">&#39;Chaîne accentuée&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">decode</span><span class="p">(</span><span class="sa">b</span><span class="s1">&#39;Cha</span><span class="se">\xee</span><span class="s1">ne accentu</span><span class="se">\xe9</span><span class="s1">e&#39;</span><span class="p">,</span> <span class="s1">&#39;latin1&#39;</span><span class="p">)</span>
+<span class="go">&#39;Chaîne accentuée&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.unicode.encode">
+<code class="descclassname">pyams_utils.unicode.</code><code class="descname">encode</code><span class="sig-paren">(</span><em>value</em>, <em>encoding='utf-8'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.unicode.encode" title="Permalink to this definition">¶</a></dt>
+<dd><p>Encode given Unicode value to bytes with given encoding</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>value</strong> (<em>str</em>) – the value to encode</li>
+<li><strong>encoding</strong> (<em>str</em>) – selected encoding</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">bytes; value encoded to bytes if input is a string, original value otherwise</p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.unicode</span> <span class="k">import</span> <span class="n">encode</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">encode</span><span class="p">(</span><span class="s1">&#39;Chaîne accentuée&#39;</span><span class="p">)</span>
+<span class="go">b&#39;Cha\xc3\xaene accentu\xc3\xa9e&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">encode</span><span class="p">(</span><span class="s1">&#39;Chaîne accentuée&#39;</span><span class="p">,</span> <span class="s1">&#39;latin1&#39;</span><span class="p">)</span>
+<span class="go">b&#39;Cha\xeene accentu\xe9e&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.unicode.nvl">
+<code class="descclassname">pyams_utils.unicode.</code><code class="descname">nvl</code><span class="sig-paren">(</span><em>value</em>, <em>default=''</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.unicode.nvl" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get specified value, or an empty string if value is empty</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>value</strong> (<em>object</em>) – value to be checked</li>
+<li><strong>default</strong> (<em>object</em>) – default value to be returned if value is <em>false</em></li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">input value, or <em>default</em> if value is <em>false</em></p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.unicode</span> <span class="k">import</span> <span class="n">nvl</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">nvl</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
+<span class="go">&#39;&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">nvl</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">)</span>
+<span class="go">&#39;foo&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">nvl</span><span class="p">(</span><span class="kc">False</span><span class="p">,</span> <span class="s1">&#39;bar&#39;</span><span class="p">)</span>
+<span class="go">&#39;bar&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.unicode.translate_string">
+<code class="descclassname">pyams_utils.unicode.</code><code class="descname">translate_string</code><span class="sig-paren">(</span><em>s</em>, <em>escape_slashes=False</em>, <em>force_lower=True</em>, <em>spaces=' '</em>, <em>remove_punctuation=True</em>, <em>keep_chars='_-.'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.unicode.translate_string" title="Permalink to this definition">¶</a></dt>
+<dd><p>Remove extended characters and diacritics from string and replace them with ‘basic’ ones</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>s</strong> (<em>str</em>) – text to be cleaned.</li>
+<li><strong>escape_slashes</strong> (<em>boolean</em>) – if True, slashes are also converted</li>
+<li><strong>force_lower</strong> (<em>boolean</em>) – if True, result is automatically converted to lower case</li>
+<li><strong>spaces</strong> (<em>str</em>) – character used to replace spaces</li>
+<li><strong>remove_punctuation</strong> (<em>boolean</em>) – if True, all punctuation characters are removed</li>
+<li><strong>keep_chars</strong> (<em>str</em>) – characters which may be kept in the input string</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">text without diacritics or special characters</p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.unicode</span> <span class="k">import</span> <span class="n">translate_string</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nb">input</span> <span class="o">=</span> <span class="s1">&#39;Ceci est un test en Français !!!&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">translate_string</span><span class="p">(</span><span class="nb">input</span><span class="p">)</span>
+<span class="go">&#39;ceci est un test en francais&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">translate_string</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">force_lower</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
+<span class="go">&#39;Ceci est un test en Francais&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">translate_string</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">)</span>
+<span class="go">&#39;ceci-est-un-test-en-francais&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">translate_string</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">remove_punctuation</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
+<span class="go">&#39;ceci est un test en francais !!!&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">translate_string</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">keep_chars</span><span class="o">=</span><span class="s1">&#39;!&#39;</span><span class="p">)</span>
+<span class="go">&#39;ceci est un test en francais !!!&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.unicode.unidict">
+<code class="descclassname">pyams_utils.unicode.</code><code class="descname">unidict</code><span class="sig-paren">(</span><em>value</em>, <em>encoding='utf-8'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.unicode.unidict" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get specified dict with values converted to unicode</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<a class="reference internal" href="#module-pyams_utils.dict" title="pyams_utils.dict"><em>dict</em></a>) – input mapping of strings which may be converted to unicode</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dict; a new mapping with each value converted to unicode</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.unicode</span> <span class="k">import</span> <span class="n">unidict</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">unidict</span><span class="p">({</span><span class="s1">&#39;input&#39;</span><span class="p">:</span> <span class="sa">b</span><span class="s1">&#39;Cha</span><span class="se">\xc3\xae</span><span class="s1">ne accentu</span><span class="se">\xc3\xa9</span><span class="s1">e&#39;</span><span class="p">})</span>
+<span class="go">{&#39;input&#39;: &#39;Chaîne accentuée&#39;}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">unidict</span><span class="p">({</span><span class="s1">&#39;input&#39;</span><span class="p">:</span> <span class="sa">b</span><span class="s1">&#39;Cha</span><span class="se">\xee</span><span class="s1">ne accentu</span><span class="se">\xe9</span><span class="s1">e&#39;</span><span class="p">},</span> <span class="s1">&#39;latin1&#39;</span><span class="p">)</span>
+<span class="go">{&#39;input&#39;: &#39;Chaîne accentuée&#39;}</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.unicode.unilist">
+<code class="descclassname">pyams_utils.unicode.</code><code class="descname">unilist</code><span class="sig-paren">(</span><em>value</em>, <em>encoding='utf-8'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.unicode.unilist" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get specified list with values converted to unicode</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<a class="reference internal" href="#module-pyams_utils.list" title="pyams_utils.list"><em>list</em></a>) – input list of strings which may be converted to unicode</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list; a new list with each value converted to unicode</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.unicode</span> <span class="k">import</span> <span class="n">unilist</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">unilist</span><span class="p">([</span><span class="sa">b</span><span class="s1">&#39;Cha</span><span class="se">\xc3\xae</span><span class="s1">ne accentu</span><span class="se">\xc3\xa9</span><span class="s1">e&#39;</span><span class="p">])</span>
+<span class="go">[&#39;Chaîne accentuée&#39;]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">unilist</span><span class="p">([</span><span class="sa">b</span><span class="s1">&#39;Cha</span><span class="se">\xee</span><span class="s1">ne accentu</span><span class="se">\xe9</span><span class="s1">e&#39;</span><span class="p">],</span> <span class="s1">&#39;latin1&#39;</span><span class="p">)</span>
+<span class="go">[&#39;Chaîne accentuée&#39;]</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.unicode.uninvl">
+<code class="descclassname">pyams_utils.unicode.</code><code class="descname">uninvl</code><span class="sig-paren">(</span><em>value</em>, <em>default=''</em>, <em>encoding='utf-8'</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.unicode.uninvl" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get specified value converted to unicode, or an empty unicode string if value is empty</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>value</strong> (<em>str/bytes</em>) – the input to be checked</li>
+<li><strong>default</strong> – str; default value</li>
+<li><strong>encoding</strong> – str; encoding name to use for conversion</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">str; value, or <em>default</em> if value is empty, converted to unicode</p>
+</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.unicode</span> <span class="k">import</span> <span class="n">uninvl</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">uninvl</span><span class="p">(</span><span class="s1">&#39;String value&#39;</span><span class="p">)</span>
+<span class="go">&#39;String value&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">uninvl</span><span class="p">(</span><span class="sa">b</span><span class="s1">&#39;String value&#39;</span><span class="p">)</span>
+<span class="go">&#39;String value&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">uninvl</span><span class="p">(</span><span class="sa">b</span><span class="s1">&#39;Cha</span><span class="se">\xc3\xae</span><span class="s1">ne accentu</span><span class="se">\xc3\xa9</span><span class="s1">e&#39;</span><span class="p">)</span>
+<span class="go">&#39;Chaîne accentuée&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">uninvl</span><span class="p">(</span><span class="sa">b</span><span class="s1">&#39;Cha</span><span class="se">\xee</span><span class="s1">ne accentu</span><span class="se">\xe9</span><span class="s1">e&#39;</span><span class="p">,</span> <span class="s1">&#39;latin1&#39;</span><span class="p">)</span>
+<span class="go">&#39;Chaîne accentuée&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.unicode.utf8">
+<code class="descclassname">pyams_utils.unicode.</code><code class="descname">utf8</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.unicode.utf8" title="Permalink to this definition">¶</a></dt>
+<dd><p>Encode given unicode value to UTF-8 encoded bytes</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<em>str</em>) – the value to encode to utf-8</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bytes; value encoded to bytes if input is a string, original value otherwise</td>
+</tr>
+</tbody>
+</table>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">pyams_utils.unicode</span> <span class="k">import</span> <span class="n">utf8</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">utf8</span><span class="p">(</span><span class="s1">&#39;Chaîne accentuée&#39;</span><span class="p">)</span>
+<span class="go">b&#39;Cha\xc3\xaene accentu\xc3\xa9e&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.url">
+<span id="pyams-utils-url-module"></span><h3>pyams_utils.url module<a class="headerlink" href="#module-pyams_utils.url" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.url.AbsoluteUrlTalesExtension">
+<em class="property">class </em><code class="descclassname">pyams_utils.url.</code><code class="descname">AbsoluteUrlTalesExtension</code><span class="sig-paren">(</span><em>context</em>, <em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.url.AbsoluteUrlTalesExtension" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.adapter.ContextRequestViewAdapter" title="pyams_utils.adapter.ContextRequestViewAdapter"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.adapter.ContextRequestViewAdapter</span></code></a></p>
+<p>extension:absolute_url(context, view_name) TALES extension</p>
+<p>A PyAMS TALES extension used to get access to an object URL from a page template.</p>
+<dl class="method">
+<dt id="pyams_utils.url.AbsoluteUrlTalesExtension.render">
+<code class="descname">render</code><span class="sig-paren">(</span><em>context=None</em>, <em>view_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.url.AbsoluteUrlTalesExtension.render" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.url.absolute_url">
+<code class="descclassname">pyams_utils.url.</code><code class="descname">absolute_url</code><span class="sig-paren">(</span><em>context</em>, <em>request</em>, <em>view_name=None</em>, <em>query=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.url.absolute_url" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get resource absolute_url</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
+<li><strong>context</strong> (<em>object</em>) – the persistent object for which absolute URL is required</li>
+<li><strong>request</strong> – the request on which URL is based</li>
+<li><strong>view_name</strong> (<em>str</em>) – an optional view name to add to URL</li>
+<li><strong>query</strong> (<em>str/dict</em>) – an optional URL arguments string or mapping</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<p>This absolute URL function is based on default Pyramid’s <code class="xref py py-func docutils literal"><span class="pre">resource_url()</span></code> function, but
+add checks to remove some double slashes, and add control on view name when it begins with a ‘#’
+character which is used by MyAMS.js framework.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.vocabulary">
+<span id="pyams-utils-vocabulary-module"></span><h3>pyams_utils.vocabulary module<a class="headerlink" href="#module-pyams_utils.vocabulary" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.vocabulary.vocabulary_config">
+<em class="property">class </em><code class="descclassname">pyams_utils.vocabulary.</code><code class="descname">vocabulary_config</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.vocabulary.vocabulary_config" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>Class decorator to define a vocabulary</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<em>str</em>) – name of the registered vocabulary</td>
+</tr>
+</tbody>
+</table>
+<p>This is, for example, how a vocabulary of registered ZEO connections utilities is created:</p>
+<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pyams_utils.interfaces.zeo</span> <span class="kn">import</span> <span class="n">IZEOConnection</span>
+
+<span class="kn">from</span> <span class="nn">pyams_utils.registry</span> <span class="kn">import</span> <span class="n">get_utilities_for</span>
+<span class="kn">from</span> <span class="nn">pyams_utils.vocabulary</span> <span class="kn">import</span> <span class="n">vocabulary_config</span>
+<span class="kn">from</span> <span class="nn">zope.schema.vocabulary</span> <span class="kn">import</span> <span class="n">SimpleTerm</span><span class="p">,</span> <span class="n">SimpleVocabulary</span>
+
+<span class="nd">@vocabulary_config</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;PyAMS ZEO connections&#39;</span><span class="p">)</span>
+<span class="k">class</span> <span class="nc">ZEOConnectionVocabulary</span><span class="p">(</span><span class="n">SimpleVocabulary</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;ZEO connections vocabulary&#39;&#39;&#39;</span>
+
+    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="n">terms</span> <span class="o">=</span> <span class="p">[</span><span class="n">SimpleTerm</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">util</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">util</span> <span class="ow">in</span> <span class="n">get_utilities_for</span><span class="p">(</span><span class="n">IZEOConnection</span><span class="p">)]</span>
+        <span class="nb">super</span><span class="p">(</span><span class="n">ZEOConnectionVocabulary</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">terms</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>You can then use such a vocabulary in any schema field:</p>
+<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">zope.interface</span> <span class="kn">import</span> <span class="n">Interface</span>
+<span class="kn">from</span> <span class="nn">zope.schema</span> <span class="kn">import</span> <span class="n">Choice</span>
+
+<span class="k">class</span> <span class="nc">MySchema</span><span class="p">(</span><span class="n">Interface</span><span class="p">):</span>
+    <span class="sd">&#39;&#39;&#39;Custom schema interface&#39;&#39;&#39;</span>
+
+    <span class="n">zeo_connection_name</span> <span class="o">=</span> <span class="n">Choice</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="s1">&#39;ZEO connection name&#39;</span><span class="p">,</span>
+                                 <span class="n">description</span><span class="o">=</span><span class="s1">&#39;Please select a registered ZEO connection&#39;</span><span class="p">,</span>
+                                 <span class="n">vocabulary</span><span class="o">=</span><span class="s1">&#39;PyAMS ZEO connections&#39;</span><span class="p">,</span>
+                                 <span class="n">required</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.wsgi">
+<span id="pyams-utils-wsgi-module"></span><h3>pyams_utils.wsgi module<a class="headerlink" href="#module-pyams_utils.wsgi" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="pyams_utils.wsgi.wsgi_environ_cache">
+<code class="descclassname">pyams_utils.wsgi.</code><code class="descname">wsgi_environ_cache</code><span class="sig-paren">(</span><em>*names</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.wsgi.wsgi_environ_cache" title="Permalink to this definition">¶</a></dt>
+<dd><p>Wrap a function/method to cache its result for call into request.environ</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>names</strong> (<em>[</em><em>string...</em><em>]</em>) – keys to cache into environ; len(names) must
+be equal to the result’s length or scalar</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</div>
+<div class="section" id="module-pyams_utils.zodb">
+<span id="pyams-utils-zodb-module"></span><h3>pyams_utils.zodb module<a class="headerlink" href="#module-pyams_utils.zodb" title="Permalink to this headline">¶</a></h3>
+<dl class="class">
+<dt id="pyams_utils.zodb.ZEOConnection">
+<em class="property">class </em><code class="descclassname">pyams_utils.zodb.</code><code class="descname">ZEOConnection</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>ZEO connection object</p>
+<p>This object can be used to store all settings to be able to open a ZEO connection.
+Note that this class is required only for tasks specifically targeting a ZEO database connection (like a ZEO
+packer scheduler task); for generic ZODB operations, just use a <a class="reference internal" href="#pyams_utils.zodb.ZODBConnection" title="pyams_utils.zodb.ZODBConnection"><code class="xref py py-class docutils literal"><span class="pre">ZODBConnection</span></code></a> class defined through
+Pyramid’s configuration file.</p>
+<p>Note that a ZEO connection object is a context manager, so you can use it like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pyams_utils.zodb</span> <span class="kn">import</span> <span class="n">ZEOConnection</span>
+
+<span class="k">def</span> <span class="nf">my_method</span><span class="p">(</span><span class="n">zeo_settings</span><span class="p">):</span>
+    <span class="n">zeo_connection</span> <span class="o">=</span> <span class="n">ZEOConnection</span><span class="p">()</span>
+    <span class="n">zeo_connection</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">zeo_settings</span><span class="p">)</span>
+    <span class="k">with</span> <span class="n">zeo_connection</span> <span class="k">as</span> <span class="n">root</span><span class="p">:</span>
+        <span class="c1"># *root* is then the ZODB root object</span>
+        <span class="c1"># do whatever you want with ZEO connection,</span>
+        <span class="c1"># which is closed automatically</span>
+</pre></div>
+</div>
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.blob_dir">
+<code class="descname">blob_dir</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.blob_dir" title="Permalink to this definition">¶</a></dt>
+<dd><p>BLOBs directory: Directory path for blob data</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.connection">
+<code class="descname">connection</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.connection" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.zodb.ZEOConnection.get_connection">
+<code class="descname">get_connection</code><span class="sig-paren">(</span><em>wait=False</em>, <em>get_storage=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.get_connection" title="Permalink to this definition">¶</a></dt>
+<dd><p>Create ZEO client connection from current settings</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>wait</strong> (<em>boolean</em>) – should connection wait until storage is ready</li>
+<li><strong>get_storage</strong> (<em>boolean</em>) – if <em>True</em>, the method should return a tuple containing
+storage and DB objects; otherwise only DB object is returned</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">tuple containing ZEO client storage and DB object (if <em>get_storage</em> argument is
+set to <em>True</em>), or only DB object otherwise</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.zodb.ZEOConnection.get_settings">
+<code class="descname">get_settings</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.get_settings" title="Permalink to this definition">¶</a></dt>
+<dd><p>Get mapping of all connection settings</p>
+<p>These settings can be converted to JSON and sent to another process, for example
+via a ØMQ connection.</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">dict</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.name">
+<code class="descname">name</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.name" title="Permalink to this definition">¶</a></dt>
+<dd><p>Connection name: Registration name of ZEO connection</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.password">
+<code class="descname">password</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.password" title="Permalink to this definition">¶</a></dt>
+<dd><p>ZEO password: User password on ZEO server</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.server_name">
+<code class="descname">server_name</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.server_name" title="Permalink to this definition">¶</a></dt>
+<dd><p>ZEO server name: Hostname of ZEO server</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.server_port">
+<code class="descname">server_port</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.server_port" title="Permalink to this definition">¶</a></dt>
+<dd><p>ZEO server port: Port number of ZEO server</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.server_realm">
+<code class="descname">server_realm</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.server_realm" title="Permalink to this definition">¶</a></dt>
+<dd><p>ZEO server realm: Realm name on ZEO server</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.shared_blob_dir">
+<code class="descname">shared_blob_dir</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.shared_blob_dir" title="Permalink to this definition">¶</a></dt>
+<dd><p>Shared BLOBs directory ?: Flag whether the blob_dir is a server-shared filesystem that should be used instead of transferring blob data over zrpc.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.storage">
+<code class="descname">storage</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.storage" title="Permalink to this definition">¶</a></dt>
+<dd><p>ZEO server storage: Storage name on ZEO server</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.zodb.ZEOConnection.update">
+<code class="descname">update</code><span class="sig-paren">(</span><em>settings</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.update" title="Permalink to this definition">¶</a></dt>
+<dd><p>Update connection properties with settings as <em>dict</em></p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>settings</strong> (<a class="reference internal" href="#module-pyams_utils.dict" title="pyams_utils.dict"><em>dict</em></a>) – typically extracted via the <a class="reference internal" href="#pyams_utils.zodb.ZEOConnection.get_settings" title="pyams_utils.zodb.ZEOConnection.get_settings"><code class="xref py py-meth docutils literal"><span class="pre">get_settings()</span></code></a> method from
+another process</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZEOConnection.username">
+<code class="descname">username</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.username" title="Permalink to this definition">¶</a></dt>
+<dd><p>ZEO user name: User name on ZEO server</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.zodb.ZEOConnectionUtility">
+<em class="property">class </em><code class="descclassname">pyams_utils.zodb.</code><code class="descname">ZEOConnectionUtility</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnectionUtility" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <a class="reference internal" href="#pyams_utils.zodb.ZEOConnection" title="pyams_utils.zodb.ZEOConnection"><code class="xref py py-class docutils literal"><span class="pre">pyams_utils.zodb.ZEOConnection</span></code></a>, <code class="xref py py-class docutils literal"><span class="pre">persistent.Persistent</span></code>, <code class="xref py py-class docutils literal"><span class="pre">zope.container.contained.Contained</span></code></p>
+<p>Persistent ZEO connection utility</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.zodb.ZEOConnectionVocabulary">
+<em class="property">class </em><code class="descclassname">pyams_utils.zodb.</code><code class="descname">ZEOConnectionVocabulary</code><span class="sig-paren">(</span><em>context=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.ZEOConnectionVocabulary" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.vocabulary.SimpleVocabulary</span></code></p>
+<p>ZEO connections vocabulary</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.zodb.ZODBConnection">
+<em class="property">class </em><code class="descclassname">pyams_utils.zodb.</code><code class="descname">ZODBConnection</code><span class="sig-paren">(</span><em>name=''</em>, <em>settings=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
+<p>ZODB connection wrapper</p>
+<p>Connections are extracted from Pyramid’s settings file in <em>zodbconn.uri</em> entries.</p>
+<p>Note that a ZODB connection object is a context manager, so you can use it like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pyams_utils.zodb</span> <span class="kn">import</span> <span class="n">ZODBConnection</span>
+
+<span class="k">def</span> <span class="nf">my_method</span><span class="p">(</span><span class="n">zodb_name</span><span class="p">):</span>
+    <span class="n">zodb_connection</span> <span class="o">=</span> <span class="n">ZODBConnection</span><span class="p">(</span><span class="n">zodb_name</span><span class="p">)</span>
+    <span class="k">with</span> <span class="n">zodb_connection</span> <span class="k">as</span> <span class="n">root</span><span class="p">:</span>
+        <span class="c1"># *root* is then the ZODB root object</span>
+        <span class="c1"># do whatever you want with ZODB connection,</span>
+        <span class="c1"># which is closed automatically</span>
+</pre></div>
+</div>
+<dl class="method">
+<dt id="pyams_utils.zodb.ZODBConnection.close">
+<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection.close" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZODBConnection.connection">
+<code class="descname">connection</code><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection.connection" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZODBConnection.db">
+<code class="descname">db</code><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection.db" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="method">
+<dt id="pyams_utils.zodb.ZODBConnection.get_connection">
+<code class="descname">get_connection</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection.get_connection" title="Permalink to this definition">¶</a></dt>
+<dd><p>Load named connection matching registry settings</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="pyams_utils.zodb.ZODBConnection.storage">
+<code class="descname">storage</code><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection.storage" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="pyams_utils.zodb.ZODBConnectionVocabulary">
+<em class="property">class </em><code class="descclassname">pyams_utils.zodb.</code><code class="descname">ZODBConnectionVocabulary</code><span class="sig-paren">(</span><em>context=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.ZODBConnectionVocabulary" title="Permalink to this definition">¶</a></dt>
+<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.vocabulary.SimpleVocabulary</span></code></p>
+<p>ZODB connections vocabulary</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.zodb.get_connection_from_settings">
+<code class="descclassname">pyams_utils.zodb.</code><code class="descname">get_connection_from_settings</code><span class="sig-paren">(</span><em>settings=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.get_connection_from_settings" title="Permalink to this definition">¶</a></dt>
+<dd><p>Load connection matching registry settings</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.zodb.handle_added_connection">
+<code class="descclassname">pyams_utils.zodb.</code><code class="descname">handle_added_connection</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.handle_added_connection" title="Permalink to this definition">¶</a></dt>
+<dd><p>Register new ZEO connection when added</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.zodb.handle_removed_connection">
+<code class="descclassname">pyams_utils.zodb.</code><code class="descname">handle_removed_connection</code><span class="sig-paren">(</span><em>event</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.handle_removed_connection" title="Permalink to this definition">¶</a></dt>
+<dd><p>Un-register ZEO connection when deleted</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.zodb.object_key_adapter">
+<code class="descclassname">pyams_utils.zodb.</code><code class="descname">object_key_adapter</code><span class="sig-paren">(</span><em>obj</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.object_key_adapter" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.zodb.persistent_connection">
+<code class="descclassname">pyams_utils.zodb.</code><code class="descname">persistent_connection</code><span class="sig-paren">(</span><em>obj</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.persistent_connection" title="Permalink to this definition">¶</a></dt>
+<dd><p>An adapter which gets a ZODB connection from a persistent object</p>
+<p>We are assuming the object has a parent if it has been created in
+this transaction.</p>
+<p>Raises ValueError if it is impossible to get a connection.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="pyams_utils.zodb.persistent_transaction_manager">
+<code class="descclassname">pyams_utils.zodb.</code><code class="descname">persistent_transaction_manager</code><span class="sig-paren">(</span><em>obj</em><span class="sig-paren">)</span><a class="headerlink" href="#pyams_utils.zodb.persistent_transaction_manager" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+</div>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
+        <div class="sphinxsidebarwrapper">
+  <h3><a href="index.html">Table Of Contents</a></h3>
+  <ul>
+<li><a class="reference internal" href="#">PyAMS utilities</a><ul>
+<li><a class="reference internal" href="#subpackages">Subpackages</a></li>
+<li><a class="reference internal" href="#module-pyams_utils">Module contents</a></li>
+<li><a class="reference internal" href="#submodules">Submodules</a><ul>
+<li><a class="reference internal" href="#module-pyams_utils.adapter">pyams_utils.adapter module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.attr">pyams_utils.attr module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.container">pyams_utils.container module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.context">pyams_utils.context module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.data">pyams_utils.data module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.date">pyams_utils.date module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.decorator">pyams_utils.decorator module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.dict">pyams_utils.dict module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.encoding">pyams_utils.encoding module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.fanstatic">pyams_utils.fanstatic module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.html">pyams_utils.html module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.i18n">pyams_utils.i18n module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.include">pyams_utils.include module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.intids">pyams_utils.intids module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.list">pyams_utils.list module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.lock">pyams_utils.lock module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.progress">pyams_utils.progress module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.property">pyams_utils.property module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.registry">pyams_utils.registry module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.request">pyams_utils.request module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.schema">pyams_utils.schema module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.session">pyams_utils.session module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.site">pyams_utils.site module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.size">pyams_utils.size module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.tales">pyams_utils.tales module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.text">pyams_utils.text module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.traversing">pyams_utils.traversing module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.unicode">pyams_utils.unicode module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.url">pyams_utils.url module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.vocabulary">pyams_utils.vocabulary module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.wsgi">pyams_utils.wsgi module</a></li>
+<li><a class="reference internal" href="#module-pyams_utils.zodb">pyams_utils.zodb module</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+
+<div id="searchbox" style="display: none" role="search">
+  <h3>Quick search</h3>
+    <form class="search" action="search.html" method="get">
+      <div><input type="text" name="q" /></div>
+      <div><input type="submit" value="Go" /></div>
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related" role="navigation" aria-label="related navigation">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> &#187;</li> 
+      </ul>
+    </div>
+    <div class="footer" role="contentinfo">
+        &#169; Copyright 2017, Thierry Florac.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5.
+    </div>
+  </body>
+</html>
\ No newline at end of file