src/build/html/pyams_utils.html
changeset 0 d153941bb745
equal deleted inserted replaced
-1:000000000000 0:d153941bb745
       
     1 
       
     2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       
     3   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
     4 
       
     5 <html xmlns="http://www.w3.org/1999/xhtml">
       
     6   <head>
       
     7     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       
     8     <title>PyAMS utilities &#8212; PyAMS User Guide 0.1.0 documentation</title>
       
     9     <link rel="stylesheet" href="_static/pyramid.css" type="text/css" />
       
    10     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
       
    11     <script type="text/javascript">
       
    12       var DOCUMENTATION_OPTIONS = {
       
    13         URL_ROOT:    './',
       
    14         VERSION:     '0.1.0',
       
    15         COLLAPSE_INDEX: false,
       
    16         FILE_SUFFIX: '.html',
       
    17         HAS_SOURCE:  true,
       
    18         SOURCELINK_SUFFIX: '.txt'
       
    19       };
       
    20     </script>
       
    21     <script type="text/javascript" src="_static/jquery.js"></script>
       
    22     <script type="text/javascript" src="_static/underscore.js"></script>
       
    23     <script type="text/javascript" src="_static/doctools.js"></script>
       
    24     <link rel="index" title="Index" href="genindex.html" />
       
    25     <link rel="search" title="Search" href="search.html" />
       
    26 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
       
    27 <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" />
       
    28 <!--[if lte IE 6]>
       
    29 <link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
       
    30 <![endif]-->
       
    31 
       
    32   </head>
       
    33   <body>
       
    34 
       
    35     <div class="related" role="navigation" aria-label="related navigation">
       
    36       <h3>Navigation</h3>
       
    37       <ul>
       
    38         <li class="right" style="margin-right: 10px">
       
    39           <a href="genindex.html" title="General Index"
       
    40              accesskey="I">index</a></li>
       
    41         <li class="right" >
       
    42           <a href="py-modindex.html" title="Python Module Index"
       
    43              >modules</a> |</li>
       
    44         <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> &#187;</li> 
       
    45       </ul>
       
    46     </div>  
       
    47 
       
    48     <div class="document">
       
    49       <div class="documentwrapper">
       
    50         <div class="bodywrapper">
       
    51           <div class="body" role="main">
       
    52             
       
    53   <div class="section" id="pyams-utilities">
       
    54 <span id="pyams-utils"></span><h1>PyAMS utilities<a class="headerlink" href="#pyams-utilities" title="Permalink to this headline">¶</a></h1>
       
    55 <div class="section" id="subpackages">
       
    56 <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2>
       
    57 <div class="toctree-wrapper compound">
       
    58 <ul>
       
    59 <li class="toctree-l1"><a class="reference internal" href="pyams_utils.interfaces.html">pyams_utils.interfaces package</a><ul>
       
    60 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.interfaces.html#module-pyams_utils.interfaces">Module contents</a></li>
       
    61 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.interfaces.html#submodules">Submodules</a><ul>
       
    62 <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>
       
    63 <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>
       
    64 <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>
       
    65 <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>
       
    66 <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>
       
    67 <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>
       
    68 <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>
       
    69 <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>
       
    70 <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>
       
    71 <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>
       
    72 </ul>
       
    73 </li>
       
    74 </ul>
       
    75 </li>
       
    76 <li class="toctree-l1"><a class="reference internal" href="pyams_utils.protocol.html">pyams_utils.protocol package</a><ul>
       
    77 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.protocol.html#module-pyams_utils.protocol">Module contents</a></li>
       
    78 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.protocol.html#submodules">Submodules</a><ul>
       
    79 <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>
       
    80 <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>
       
    81 </ul>
       
    82 </li>
       
    83 </ul>
       
    84 </li>
       
    85 <li class="toctree-l1"><a class="reference internal" href="pyams_utils.scripts.html">pyams_utils.scripts package</a><ul>
       
    86 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.scripts.html#module-pyams_utils.scripts">Module contents</a></li>
       
    87 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.scripts.html#submodules">Submodules</a><ul>
       
    88 <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>
       
    89 </ul>
       
    90 </li>
       
    91 </ul>
       
    92 </li>
       
    93 <li class="toctree-l1"><a class="reference internal" href="pyams_utils.tests.html">pyams_utils.tests package</a><ul>
       
    94 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.tests.html#module-pyams_utils.tests">Module contents</a></li>
       
    95 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.tests.html#submodules">Submodules</a><ul>
       
    96 <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>
       
    97 <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>
       
    98 </ul>
       
    99 </li>
       
   100 </ul>
       
   101 </li>
       
   102 <li class="toctree-l1"><a class="reference internal" href="pyams_utils.timezone.html">pyams_utils.timezone package</a><ul>
       
   103 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.timezone.html#module-pyams_utils.timezone">Module contents</a></li>
       
   104 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.timezone.html#submodules">Submodules</a><ul>
       
   105 <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>
       
   106 <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>
       
   107 </ul>
       
   108 </li>
       
   109 </ul>
       
   110 </li>
       
   111 <li class="toctree-l1"><a class="reference internal" href="pyams_utils.widget.html">pyams_utils.widget package</a><ul>
       
   112 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.widget.html#module-pyams_utils.widget">Module contents</a></li>
       
   113 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.widget.html#submodules">Submodules</a><ul>
       
   114 <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>
       
   115 </ul>
       
   116 </li>
       
   117 </ul>
       
   118 </li>
       
   119 <li class="toctree-l1"><a class="reference internal" href="pyams_utils.zmi.html">pyams_utils.zmi package</a><ul>
       
   120 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.zmi.html#module-pyams_utils.zmi">Module contents</a></li>
       
   121 <li class="toctree-l2"><a class="reference internal" href="pyams_utils.zmi.html#submodules">Submodules</a><ul>
       
   122 <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>
       
   123 <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>
       
   124 <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>
       
   125 </ul>
       
   126 </li>
       
   127 </ul>
       
   128 </li>
       
   129 </ul>
       
   130 </div>
       
   131 </div>
       
   132 <div class="section" id="module-pyams_utils">
       
   133 <span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pyams_utils" title="Permalink to this headline">¶</a></h2>
       
   134 <dl class="function">
       
   135 <dt id="pyams_utils.includeme">
       
   136 <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>
       
   137 <dd><p>pyams_utils features include</p>
       
   138 </dd></dl>
       
   139 
       
   140 </div>
       
   141 <div class="section" id="submodules">
       
   142 <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
       
   143 <div class="section" id="module-pyams_utils.adapter">
       
   144 <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>
       
   145 <p>Adapters management package</p>
       
   146 <p>This package provides a small set of standard base adapters for <em>context</em>, <em>context</em> and <em>request</em>, and
       
   147 <em>context</em> and <em>request</em> and <em>view</em>.</p>
       
   148 <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>
       
   149 <dl class="class">
       
   150 <dt id="pyams_utils.adapter.ContextAdapter">
       
   151 <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>
       
   152 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
   153 <p>Context adapter</p>
       
   154 </dd></dl>
       
   155 
       
   156 <dl class="class">
       
   157 <dt id="pyams_utils.adapter.ContextRequestAdapter">
       
   158 <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>
       
   159 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
   160 <p>Context + request multi-adapter</p>
       
   161 </dd></dl>
       
   162 
       
   163 <dl class="class">
       
   164 <dt id="pyams_utils.adapter.ContextRequestViewAdapter">
       
   165 <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>
       
   166 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
   167 <p>Context + request + view multi-adapter</p>
       
   168 </dd></dl>
       
   169 
       
   170 <dl class="class">
       
   171 <dt id="pyams_utils.adapter.NullAdapter">
       
   172 <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>
       
   173 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
   174 <p>An adapter which always return None!</p>
       
   175 <p>Can be useful to override a default adapter…</p>
       
   176 </dd></dl>
       
   177 
       
   178 <dl class="class">
       
   179 <dt id="pyams_utils.adapter.adapter_config">
       
   180 <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>
       
   181 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
   182 <p>Function or class decorator to declare an adapter</p>
       
   183 <p>Annotation parameters can be:</p>
       
   184 <table class="docutils field-list" frame="void" rules="none">
       
   185 <col class="field-name" />
       
   186 <col class="field-body" />
       
   187 <tbody valign="top">
       
   188 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
   189 <li><strong>name</strong> (<em>str</em>) – (default=’‘), name of the adapter</li>
       
   190 <li><strong>context</strong> (<em>[</em><em>Interface...</em><em>]</em>) – an interface, or a tuple of interfaces, that the component adapts</li>
       
   191 <li><strong>provides</strong> (<em>Interface</em>) – the interface that the adapter provides</li>
       
   192 </ul>
       
   193 </td>
       
   194 </tr>
       
   195 </tbody>
       
   196 </table>
       
   197 <dl class="attribute">
       
   198 <dt id="pyams_utils.adapter.adapter_config.venusian">
       
   199 <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>
       
   200 <dd></dd></dl>
       
   201 
       
   202 </dd></dl>
       
   203 
       
   204 </div>
       
   205 <div class="section" id="module-pyams_utils.attr">
       
   206 <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>
       
   207 <dl class="class">
       
   208 <dt id="pyams_utils.attr.AttributeTraverser">
       
   209 <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>
       
   210 <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>
       
   211 <p>++attr++ namespace traverser</p>
       
   212 <p>This custom traversing adapter can be used to access an object attribute directly from
       
   213 an URL by using a path like this:</p>
       
   214 <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>
       
   215 </pre></div>
       
   216 </div>
       
   217 <p>Whare <em>name</em> is the name of the requested attribute</p>
       
   218 <dl class="method">
       
   219 <dt id="pyams_utils.attr.AttributeTraverser.traverse">
       
   220 <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>
       
   221 <dd></dd></dl>
       
   222 
       
   223 </dd></dl>
       
   224 
       
   225 </div>
       
   226 <div class="section" id="module-pyams_utils.container">
       
   227 <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>
       
   228 <dl class="class">
       
   229 <dt id="pyams_utils.container.BTreeOrderedContainer">
       
   230 <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>
       
   231 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.container.ordered.OrderedContainer</span></code></p>
       
   232 <p>BTree based ordered container</p>
       
   233 <p>This container maintain a manual order of it’s contents</p>
       
   234 </dd></dl>
       
   235 
       
   236 <dl class="class">
       
   237 <dt id="pyams_utils.container.ContainerSublocationsAdapter">
       
   238 <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>
       
   239 <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>
       
   240 <p>Contained object sub-locations adapter</p>
       
   241 <p>This adapter checks for custom ISublocations interface adapters which can
       
   242 be defined by any component to get access to inner locations, defined for
       
   243 example via annotations.</p>
       
   244 <dl class="method">
       
   245 <dt id="pyams_utils.container.ContainerSublocationsAdapter.sublocations">
       
   246 <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>
       
   247 <dd><p>See <cite>zope.location.interfaces.ISublocations</cite> interface</p>
       
   248 </dd></dl>
       
   249 
       
   250 </dd></dl>
       
   251 
       
   252 <dl class="function">
       
   253 <dt id="pyams_utils.container.find_objects_matching">
       
   254 <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>
       
   255 <dd><p>Find all objects in root that match the condition</p>
       
   256 <p>The condition is a Python callable object that takes an object as
       
   257 argument and must return a boolean result.</p>
       
   258 <p>All sub-objects of the root will also be searched recursively.</p>
       
   259 <table class="docutils field-list" frame="void" rules="none">
       
   260 <col class="field-name" />
       
   261 <col class="field-body" />
       
   262 <tbody valign="top">
       
   263 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
   264 <li><strong>root</strong> (<em>object</em>) – the parent object from which search is started</li>
       
   265 <li><strong>condition</strong> (<em>callable</em>) – a callable object which may return true for a given
       
   266 object to be selected</li>
       
   267 <li><strong>ignore_root</strong> (<em>boolean</em>) – if <em>True</em>, the root object will not be returned, even if it matches
       
   268 the given condition</li>
       
   269 </ul>
       
   270 </td>
       
   271 </tr>
       
   272 <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>
       
   273 </td>
       
   274 </tr>
       
   275 </tbody>
       
   276 </table>
       
   277 </dd></dl>
       
   278 
       
   279 <dl class="function">
       
   280 <dt id="pyams_utils.container.find_objects_providing">
       
   281 <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>
       
   282 <dd><p>Find all objects in root that provide the specified interface</p>
       
   283 <p>All sub-objects of the root will also be searched recursively.</p>
       
   284 <table class="docutils field-list" frame="void" rules="none">
       
   285 <col class="field-name" />
       
   286 <col class="field-body" />
       
   287 <tbody valign="top">
       
   288 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
   289 <li><strong>root</strong> (<em>object</em>) – object; the parent object from which search is started</li>
       
   290 <li><strong>interface</strong> (<em>Interface</em>) – interface; an interface that sub-objects should provide</li>
       
   291 </ul>
       
   292 </td>
       
   293 </tr>
       
   294 <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>
       
   295 </td>
       
   296 </tr>
       
   297 </tbody>
       
   298 </table>
       
   299 </dd></dl>
       
   300 
       
   301 </div>
       
   302 <div class="section" id="module-pyams_utils.context">
       
   303 <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>
       
   304 <dl class="class">
       
   305 <dt id="pyams_utils.context.ContextSelector">
       
   306 <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>
       
   307 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
   308 <p>Interface based context selector</p>
       
   309 <p>This selector can be used as a subscriber predicate to define
       
   310 an interface that the context must support for the event to be applied:</p>
       
   311 <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>
       
   312 </pre></div>
       
   313 </div>
       
   314 <blockquote>
       
   315 <div><p>from pyams_utils.interfaces.site import ISiteRoot</p>
       
   316 <p>&#64;subscriber(IObjectModifiedEvent, context_selector=ISiteRoot)
       
   317 def siteroot_modified_event_handler(event):</p>
       
   318 <blockquote>
       
   319 <div>‘’‘This is an event handler for an ISiteRoot object modification event’‘’</div></blockquote>
       
   320 </div></blockquote>
       
   321 <dl class="method">
       
   322 <dt id="pyams_utils.context.ContextSelector.phash">
       
   323 <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>
       
   324 <dd></dd></dl>
       
   325 
       
   326 <dl class="method">
       
   327 <dt id="pyams_utils.context.ContextSelector.text">
       
   328 <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>
       
   329 <dd></dd></dl>
       
   330 
       
   331 </dd></dl>
       
   332 
       
   333 </div>
       
   334 <div class="section" id="module-pyams_utils.data">
       
   335 <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>
       
   336 <p>Object data API module</p>
       
   337 <p>The <em>IObjectData</em> interface is a generic interface which can be used to assign custom data to nay object.
       
   338 This object data may be any object which can be serialized to JSON, and assigned to any HTML <em>data</em> attribute.
       
   339 It can typically be used to set a <em>data-ams-data</em> attribute to objects, which is afterwards converted to
       
   340 classic <em>data-</em> attributes by <strong>MyAMS.js</strong> framework.</p>
       
   341 <p>For example, for a custom widget in a form:</p>
       
   342 <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>
       
   343     <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>
       
   344     <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>
       
   345     <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>
       
   346     <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>
       
   347 </pre></div>
       
   348 </div>
       
   349 <p>You can then set an attribute in a TAL template like this:</p>
       
   350 <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>
       
   351 </pre></div>
       
   352 </div>
       
   353 <p>After data initialization by <strong>MyAMS.js</strong>, the following code will be converted to:</p>
       
   354 <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>
       
   355 </pre></div>
       
   356 </div>
       
   357 <dl class="class">
       
   358 <dt id="pyams_utils.data.BrowserRequestDataExtension">
       
   359 <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>
       
   360 <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>
       
   361 <p>extension:request_data TALES extension for Zope browser request</p>
       
   362 <p>This TALES extension can be used to get a request data, previously stored in the request via an annotation.
       
   363 For example:</p>
       
   364 <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>
       
   365 </pre></div>
       
   366 </div>
       
   367 <blockquote>
       
   368 <div>&lt;div tal:content=”extension:request_data(‘my.annotation.key’)”&gt;…&lt;/div&gt;</div></blockquote>
       
   369 <dl class="method">
       
   370 <dt id="pyams_utils.data.BrowserRequestDataExtension.render">
       
   371 <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>
       
   372 <dd><p>See <cite>pyams_utils.interfaces.tales.ITALESExtension</cite> interface</p>
       
   373 </dd></dl>
       
   374 
       
   375 </dd></dl>
       
   376 
       
   377 <dl class="class">
       
   378 <dt id="pyams_utils.data.ObjectDataExtension">
       
   379 <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>
       
   380 <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>
       
   381 <p>extension:object_data TALES extension</p>
       
   382 <p>This TALES extension is to be used in Chameleon templates to define a custom data attribute
       
   383 which stores all object data (see <cite>pyams_utils.interfaces.data.IObjectData</cite> interface), like this:</p>
       
   384 <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>
       
   385 </pre></div>
       
   386 </div>
       
   387 <blockquote>
       
   388 <div>&lt;div tal:attributes=”data-ams-data extension:object_data(context)”&gt;…&lt;/div&gt;</div></blockquote>
       
   389 <dl class="method">
       
   390 <dt id="pyams_utils.data.ObjectDataExtension.render">
       
   391 <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>
       
   392 <dd><p>See <cite>pyams_utils.interfaces.tales.ITALESExtension</cite> interface</p>
       
   393 </dd></dl>
       
   394 
       
   395 </dd></dl>
       
   396 
       
   397 <dl class="class">
       
   398 <dt id="pyams_utils.data.ObjectDataRenderer">
       
   399 <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>
       
   400 <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>
       
   401 <p>Object data JSON renderer</p>
       
   402 <dl class="method">
       
   403 <dt id="pyams_utils.data.ObjectDataRenderer.get_object_data">
       
   404 <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>
       
   405 <dd><p>See <cite>pyams_utils.interfaces.data.IObjectDataRenderer</cite> interface</p>
       
   406 </dd></dl>
       
   407 
       
   408 </dd></dl>
       
   409 
       
   410 <dl class="class">
       
   411 <dt id="pyams_utils.data.PyramidRequestDataExtension">
       
   412 <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>
       
   413 <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>
       
   414 <p>extension:request_data TALES extension for Pyramid request</p>
       
   415 <p>This TALES extension can be used to get a request data, previously stored in the request via an annotation.
       
   416 For example:</p>
       
   417 <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>
       
   418 </pre></div>
       
   419 </div>
       
   420 <blockquote>
       
   421 <div>&lt;div tal:content=”extension:request_data(‘my.annotation.key’)”&gt;…&lt;/div&gt;</div></blockquote>
       
   422 <dl class="method">
       
   423 <dt id="pyams_utils.data.PyramidRequestDataExtension.render">
       
   424 <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>
       
   425 <dd><p>See <cite>pyams_utils.interfaces.tales.ITALESExtension</cite> interface</p>
       
   426 </dd></dl>
       
   427 
       
   428 </dd></dl>
       
   429 
       
   430 </div>
       
   431 <div class="section" id="module-pyams_utils.date">
       
   432 <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>
       
   433 <dl class="function">
       
   434 <dt id="pyams_utils.date.date_to_datetime">
       
   435 <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>
       
   436 <dd><p>Get datetime value converted from a date or datetime object</p>
       
   437 <table class="docutils field-list" frame="void" rules="none">
       
   438 <col class="field-name" />
       
   439 <col class="field-body" />
       
   440 <tbody valign="top">
       
   441 <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>
       
   442 </tr>
       
   443 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">datetime; input value converted to datetime</td>
       
   444 </tr>
       
   445 </tbody>
       
   446 </table>
       
   447 <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>
       
   448 <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>
       
   449 <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>
       
   450 <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>
       
   451 <span class="go">datetime.datetime(2016, 11, 15, 0, 0)</span>
       
   452 <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>
       
   453 <span class="gp">&gt;&gt;&gt; </span><span class="n">value</span>
       
   454 <span class="go">datetime.datetime(2016, 11, 15, 10, 13, 12)</span>
       
   455 <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>
       
   456 <span class="go">True</span>
       
   457 </pre></div>
       
   458 </div>
       
   459 </dd></dl>
       
   460 
       
   461 <dl class="function">
       
   462 <dt id="pyams_utils.date.format_date">
       
   463 <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>
       
   464 <dd><p>Format given date with the given format</p>
       
   465 <table class="docutils field-list" frame="void" rules="none">
       
   466 <col class="field-name" />
       
   467 <col class="field-body" />
       
   468 <tbody valign="top">
       
   469 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
   470 <li><strong>value</strong> (<em>datetime</em>) – the value to format</li>
       
   471 <li><strong>format</strong> (<em>str</em>) – a format string to use by <cite>strftime</cite> function</li>
       
   472 <li><strong>request</strong> – the request from which to extract localization info for translation</li>
       
   473 </ul>
       
   474 </td>
       
   475 </tr>
       
   476 <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>
       
   477 </td>
       
   478 </tr>
       
   479 </tbody>
       
   480 </table>
       
   481 <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>
       
   482 <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>
       
   483 <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>
       
   484 <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>
       
   485 <span class="go">&#39;on 15/11/2016&#39;</span>
       
   486 <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>
       
   487 <span class="go">&#39;15/11/2016&#39;</span>
       
   488 </pre></div>
       
   489 </div>
       
   490 </dd></dl>
       
   491 
       
   492 <dl class="function">
       
   493 <dt id="pyams_utils.date.format_datetime">
       
   494 <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>
       
   495 <dd><p>Format given datetime with the given format including time</p>
       
   496 <table class="docutils field-list" frame="void" rules="none">
       
   497 <col class="field-name" />
       
   498 <col class="field-body" />
       
   499 <tbody valign="top">
       
   500 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
   501 <li><strong>value</strong> (<em>datetime</em>) – the value to format</li>
       
   502 <li><strong>format</strong> (<em>str</em>) – a format string to use by <cite>strftime</cite> function</li>
       
   503 <li><strong>request</strong> – request; the request from which to extract localization info for translation</li>
       
   504 </ul>
       
   505 </td>
       
   506 </tr>
       
   507 <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>
       
   508 </td>
       
   509 </tr>
       
   510 </tbody>
       
   511 </table>
       
   512 <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>
       
   513 <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>
       
   514 <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>
       
   515 <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>
       
   516 <span class="go">&#39;on 15/11/2016 at 10:13&#39;</span>
       
   517 <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>
       
   518 <span class="go">&#39;15/11/2016 - 10:13&#39;</span>
       
   519 </pre></div>
       
   520 </div>
       
   521 </dd></dl>
       
   522 
       
   523 <dl class="function">
       
   524 <dt id="pyams_utils.date.get_age">
       
   525 <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>
       
   526 <dd><p>Get ‘human’ age of a given datetime (including timezone) compared to current datetime (in UTC)</p>
       
   527 <table class="docutils field-list" frame="void" rules="none">
       
   528 <col class="field-name" />
       
   529 <col class="field-body" />
       
   530 <tbody valign="top">
       
   531 <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>
       
   532 </tr>
       
   533 <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>
       
   534 </tr>
       
   535 </tbody>
       
   536 </table>
       
   537 </dd></dl>
       
   538 
       
   539 <dl class="function">
       
   540 <dt id="pyams_utils.date.get_duration">
       
   541 <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>
       
   542 <dd><p>Get ‘human’ delta as string between two dates</p>
       
   543 <table class="docutils field-list" frame="void" rules="none">
       
   544 <col class="field-name" />
       
   545 <col class="field-body" />
       
   546 <tbody valign="top">
       
   547 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
   548 <li><strong>v1</strong> (<em>datetime</em>) – start date</li>
       
   549 <li><strong>v2</strong> (<em>datetime</em>) – end date, or current date (in UTC) if None</li>
       
   550 <li><strong>request</strong> – the request from which to extract localization infos</li>
       
   551 </ul>
       
   552 </td>
       
   553 </tr>
       
   554 <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>
       
   555 </td>
       
   556 </tr>
       
   557 </tbody>
       
   558 </table>
       
   559 <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>
       
   560 <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>
       
   561 <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>
       
   562 <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>
       
   563 <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>
       
   564 <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>
       
   565 <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>
       
   566 <span class="go">&#39;10 months&#39;</span>
       
   567 </pre></div>
       
   568 </div>
       
   569 <p>Dates order is not important:</p>
       
   570 <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>
       
   571 <span class="go">&#39;10 months&#39;</span>
       
   572 <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>
       
   573 <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>
       
   574 <span class="go">&#39;7 weeks&#39;</span>
       
   575 <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>
       
   576 <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>
       
   577 <span class="go">&#39;6 days&#39;</span>
       
   578 </pre></div>
       
   579 </div>
       
   580 <p>For durations lower than 2 days, duration also display hours:</p>
       
   581 <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>
       
   582 <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>
       
   583 <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>
       
   584 <span class="go">&#39;1 day and 15 hours&#39;</span>
       
   585 <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>
       
   586 <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>
       
   587 <span class="go">&#39;24 hours&#39;</span>
       
   588 <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>
       
   589 <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>
       
   590 <span class="go">&#39;13 hours&#39;</span>
       
   591 <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>
       
   592 <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>
       
   593 <span class="go">&#39;75 minutes&#39;</span>
       
   594 <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>
       
   595 <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>
       
   596 <span class="go">&#39;15 seconds&#39;</span>
       
   597 </pre></div>
       
   598 </div>
       
   599 </dd></dl>
       
   600 
       
   601 <dl class="function">
       
   602 <dt id="pyams_utils.date.parse_date">
       
   603 <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>
       
   604 <dd><p>Get date specified in unicode ISO format to Python datetime object</p>
       
   605 <p>Dates are always assumed to be stored in GMT timezone</p>
       
   606 <table class="docutils field-list" frame="void" rules="none">
       
   607 <col class="field-name" />
       
   608 <col class="field-body" />
       
   609 <tbody valign="top">
       
   610 <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>
       
   611 </tr>
       
   612 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">datetime; the specified value, converted to datetime</td>
       
   613 </tr>
       
   614 </tbody>
       
   615 </table>
       
   616 <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>
       
   617 <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>
       
   618 <span class="go">datetime.datetime(2016, 11, 15, 10, 13, 12, tzinfo=&lt;StaticTzInfo &#39;GMT&#39;&gt;)</span>
       
   619 </pre></div>
       
   620 </div>
       
   621 </dd></dl>
       
   622 
       
   623 <dl class="function">
       
   624 <dt id="pyams_utils.date.unidate">
       
   625 <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>
       
   626 <dd><p>Get specified date converted to unicode ISO format</p>
       
   627 <p>Dates are always assumed to be stored in GMT timezone</p>
       
   628 <table class="docutils field-list" frame="void" rules="none">
       
   629 <col class="field-name" />
       
   630 <col class="field-body" />
       
   631 <tbody valign="top">
       
   632 <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>
       
   633 </tr>
       
   634 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">unicode; input date converted to unicode</td>
       
   635 </tr>
       
   636 </tbody>
       
   637 </table>
       
   638 <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>
       
   639 <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>
       
   640 <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>
       
   641 <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>
       
   642 <span class="go">&#39;2016-11-15T10:13:12+00:00&#39;</span>
       
   643 </pre></div>
       
   644 </div>
       
   645 </dd></dl>
       
   646 
       
   647 </div>
       
   648 <div class="section" id="module-pyams_utils.decorator">
       
   649 <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>
       
   650 <dl class="function">
       
   651 <dt id="pyams_utils.decorator.deprecated">
       
   652 <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>
       
   653 <dd><p>This is a decorator which can be used to mark functions as deprecated.</p>
       
   654 <p>It will result in a warning being emitted when the function is used.</p>
       
   655 </dd></dl>
       
   656 
       
   657 </div>
       
   658 <div class="section" id="module-pyams_utils.dict">
       
   659 <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>
       
   660 <dl class="function">
       
   661 <dt id="pyams_utils.dict.update_dict">
       
   662 <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>
       
   663 <dd><p>Update given mapping if input value is a boolean ‘true’ value</p>
       
   664 <table class="docutils field-list" frame="void" rules="none">
       
   665 <col class="field-name" />
       
   666 <col class="field-body" />
       
   667 <tbody valign="top">
       
   668 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
   669 <li><strong>input</strong> (<a class="reference internal" href="#module-pyams_utils.dict" title="pyams_utils.dict"><em>dict</em></a>) – input dictionary</li>
       
   670 <li><strong>key</strong> – mapping key</li>
       
   671 <li><strong>value</strong> – new value</li>
       
   672 </ul>
       
   673 </td>
       
   674 </tr>
       
   675 </tbody>
       
   676 </table>
       
   677 <p>‘False’ values leave mapping unchanged:</p>
       
   678 <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>
       
   679 <span class="gp">&gt;&gt;&gt; </span><span class="n">mydict</span> <span class="o">=</span> <span class="p">{}</span>
       
   680 <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>
       
   681 <span class="gp">&gt;&gt;&gt; </span><span class="n">mydict</span>
       
   682 </pre></div>
       
   683 </div>
       
   684 <p>{}
       
   685 &gt;&gt;&gt; update_dict(mydict, ‘key1’, ‘’)
       
   686 &gt;&gt;&gt; mydict
       
   687 {}
       
   688 &gt;&gt;&gt; update_dict(mydict, ‘key1’, 0)
       
   689 &gt;&gt;&gt; mydict
       
   690 {}</p>
       
   691 <p>‘True’ values modify the mapping:</p>
       
   692 <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>
       
   693 <span class="gp">&gt;&gt;&gt; </span><span class="n">mydict</span>
       
   694 </pre></div>
       
   695 </div>
       
   696 <p>{‘key1’: ‘value’}
       
   697 &gt;&gt;&gt; update_dict(mydict, ‘key1’, ‘value2’)
       
   698 &gt;&gt;&gt; mydict
       
   699 {‘key1’: ‘value2’}</p>
       
   700 </dd></dl>
       
   701 
       
   702 </div>
       
   703 <div class="section" id="module-pyams_utils.encoding">
       
   704 <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>
       
   705 <dl class="class">
       
   706 <dt id="pyams_utils.encoding.EncodingField">
       
   707 <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>
       
   708 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.Choice</span></code></p>
       
   709 <p>Encoding schema field</p>
       
   710 </dd></dl>
       
   711 
       
   712 <dl class="class">
       
   713 <dt id="pyams_utils.encoding.EncodingsVocabulary">
       
   714 <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>
       
   715 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.vocabulary.SimpleVocabulary</span></code></p>
       
   716 <p>A vocabulary containing a set of registered encodings</p>
       
   717 </dd></dl>
       
   718 
       
   719 </div>
       
   720 <div class="section" id="module-pyams_utils.fanstatic">
       
   721 <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>
       
   722 <dl class="class">
       
   723 <dt id="pyams_utils.fanstatic.ExternalResource">
       
   724 <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>
       
   725 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">fanstatic.core.Resource</span></code></p>
       
   726 <p>Fanstatic external resource</p>
       
   727 <dl class="method">
       
   728 <dt id="pyams_utils.fanstatic.ExternalResource.render">
       
   729 <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>
       
   730 <dd></dd></dl>
       
   731 
       
   732 </dd></dl>
       
   733 
       
   734 <dl class="class">
       
   735 <dt id="pyams_utils.fanstatic.FanstaticTalesExtension">
       
   736 <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>
       
   737 <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>
       
   738 <p>extension:resource_path() TALES extension</p>
       
   739 <p>This TALES extension generates an URL matching a given Fanstatic resource.
       
   740 Resource is given as a string made of package name (in dotted form) followed by a colon and by the resource name.</p>
       
   741 <p>For example:</p>
       
   742 <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>
       
   743 </pre></div>
       
   744 </div>
       
   745 <blockquote>
       
   746 <div>&lt;div tal:attributes=”data-ams-plugin-pyams_content-src extension:resource_path(‘pyams_content.skin:pyams_content’)” /&gt;</div></blockquote>
       
   747 <dl class="method">
       
   748 <dt id="pyams_utils.fanstatic.FanstaticTalesExtension.render">
       
   749 <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>
       
   750 <dd></dd></dl>
       
   751 
       
   752 </dd></dl>
       
   753 
       
   754 <dl class="function">
       
   755 <dt id="pyams_utils.fanstatic.get_resource_path">
       
   756 <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>
       
   757 <dd><p>Get path for given resource</p>
       
   758 </dd></dl>
       
   759 
       
   760 <dl class="function">
       
   761 <dt id="pyams_utils.fanstatic.render_js">
       
   762 <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>
       
   763 <dd></dd></dl>
       
   764 
       
   765 </div>
       
   766 <div class="section" id="module-pyams_utils.html">
       
   767 <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>
       
   768 <dl class="class">
       
   769 <dt id="pyams_utils.html.MyHTMLParser">
       
   770 <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>
       
   771 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">html.parser.HTMLParser</span></code></p>
       
   772 <p>HTML parser</p>
       
   773 <dl class="attribute">
       
   774 <dt id="pyams_utils.html.MyHTMLParser.charrefs">
       
   775 <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>
       
   776 <dd></dd></dl>
       
   777 
       
   778 <dl class="attribute">
       
   779 <dt id="pyams_utils.html.MyHTMLParser.data">
       
   780 <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>
       
   781 <dd></dd></dl>
       
   782 
       
   783 <dl class="attribute">
       
   784 <dt id="pyams_utils.html.MyHTMLParser.entitydefs">
       
   785 <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>
       
   786 <dd></dd></dl>
       
   787 
       
   788 <dl class="method">
       
   789 <dt id="pyams_utils.html.MyHTMLParser.handle_charref">
       
   790 <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>
       
   791 <dd></dd></dl>
       
   792 
       
   793 <dl class="method">
       
   794 <dt id="pyams_utils.html.MyHTMLParser.handle_data">
       
   795 <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>
       
   796 <dd></dd></dl>
       
   797 
       
   798 <dl class="method">
       
   799 <dt id="pyams_utils.html.MyHTMLParser.handle_endtag">
       
   800 <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>
       
   801 <dd></dd></dl>
       
   802 
       
   803 <dl class="method">
       
   804 <dt id="pyams_utils.html.MyHTMLParser.handle_entityref">
       
   805 <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>
       
   806 <dd></dd></dl>
       
   807 
       
   808 <dl class="method">
       
   809 <dt id="pyams_utils.html.MyHTMLParser.handle_starttag">
       
   810 <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>
       
   811 <dd></dd></dl>
       
   812 
       
   813 </dd></dl>
       
   814 
       
   815 <dl class="function">
       
   816 <dt id="pyams_utils.html.html_to_text">
       
   817 <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>
       
   818 <dd><p>Utility function to extract text content from HTML</p>
       
   819 <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>
       
   820 <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>
       
   821 <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>
       
   822 <span class="go">&#39;This is a HTML text part.\n&#39;</span>
       
   823 </pre></div>
       
   824 </div>
       
   825 <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>
       
   826 <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>
       
   827 <span class="go">&#39;This is text with french accents: é à è ù\n&#39;</span>
       
   828 </pre></div>
       
   829 </div>
       
   830 <p>HTML parser should handle entities correctly:</p>
       
   831 <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>
       
   832 <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>
       
   833 <span class="go">&#39;Header\nThis is an &lt; ò &gt; entity.\n\n&#39;</span>
       
   834 </pre></div>
       
   835 </div>
       
   836 <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>
       
   837 <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>
       
   838 <span class="go">&#39;Header\nThis is an &lt; ò &gt; entity.\n\n&#39;</span>
       
   839 </pre></div>
       
   840 </div>
       
   841 </dd></dl>
       
   842 
       
   843 </div>
       
   844 <div class="section" id="module-pyams_utils.i18n">
       
   845 <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>
       
   846 <dl class="function">
       
   847 <dt id="pyams_utils.i18n.get_browser_language">
       
   848 <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>
       
   849 <dd><p>Custom locale negotiator</p>
       
   850 <p>Copied from zope.publisher code</p>
       
   851 </dd></dl>
       
   852 
       
   853 <dl class="function">
       
   854 <dt id="pyams_utils.i18n.normalize_lang">
       
   855 <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>
       
   856 <dd></dd></dl>
       
   857 
       
   858 </div>
       
   859 <div class="section" id="module-pyams_utils.include">
       
   860 <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>
       
   861 <dl class="function">
       
   862 <dt id="pyams_utils.include.include_package">
       
   863 <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>
       
   864 <dd><p>Pyramid package include</p>
       
   865 </dd></dl>
       
   866 
       
   867 </div>
       
   868 <div class="section" id="module-pyams_utils.intids">
       
   869 <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>
       
   870 <dl class="class">
       
   871 <dt id="pyams_utils.intids.UniqueIdAdapter">
       
   872 <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>
       
   873 <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>
       
   874 <p>Object unique ID adapter</p>
       
   875 <p>This adapter is based on a registered IIntIds utility to get a unique ID
       
   876 for any persistent object.</p>
       
   877 <dl class="attribute">
       
   878 <dt id="pyams_utils.intids.UniqueIdAdapter.oid">
       
   879 <code class="descname">oid</code><a class="headerlink" href="#pyams_utils.intids.UniqueIdAdapter.oid" title="Permalink to this definition">¶</a></dt>
       
   880 <dd><p>Get context ID in hexadecimal form</p>
       
   881 </dd></dl>
       
   882 
       
   883 </dd></dl>
       
   884 
       
   885 <dl class="function">
       
   886 <dt id="pyams_utils.intids.handle_added_object">
       
   887 <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>
       
   888 <dd><p>Notify IntId utility for added objects</p>
       
   889 <p>This subscriber is used for all persistent objects to be registered
       
   890 in all locally registered IIntIds utilities.</p>
       
   891 </dd></dl>
       
   892 
       
   893 <dl class="function">
       
   894 <dt id="pyams_utils.intids.handle_intid_event">
       
   895 <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>
       
   896 <dd><p>Event subscriber used to dispatch all IIntIdEvent events using Pyramid events subscribers to matching
       
   897 subscribers using Zope events</p>
       
   898 </dd></dl>
       
   899 
       
   900 <dl class="function">
       
   901 <dt id="pyams_utils.intids.handle_removed_object">
       
   902 <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>
       
   903 <dd><p>Notify IntId utility for removed objects</p>
       
   904 <p>This subscriber is used for all persistent objects to be unregistered
       
   905 from all locally registered IIntIds utilities.</p>
       
   906 </dd></dl>
       
   907 
       
   908 </div>
       
   909 <div class="section" id="module-pyams_utils.list">
       
   910 <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>
       
   911 <dl class="function">
       
   912 <dt id="pyams_utils.list.unique">
       
   913 <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>
       
   914 <dd><p>Extract unique values from list, preserving order</p>
       
   915 <table class="docutils field-list" frame="void" rules="none">
       
   916 <col class="field-name" />
       
   917 <col class="field-body" />
       
   918 <tbody valign="top">
       
   919 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
   920 <li><strong>seq</strong> (<em>iterator</em>) – input list</li>
       
   921 <li><strong>idfun</strong> (<em>callable</em>) – an identity function which is used to get ‘identity’ value of each element
       
   922 in the list</li>
       
   923 </ul>
       
   924 </td>
       
   925 </tr>
       
   926 <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.
       
   927 Original list is not modified.</p>
       
   928 </td>
       
   929 </tr>
       
   930 </tbody>
       
   931 </table>
       
   932 <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>
       
   933 <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>
       
   934 <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>
       
   935 <span class="go">[1, 2, 3]</span>
       
   936 </pre></div>
       
   937 </div>
       
   938 <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>
       
   939 <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>
       
   940 <span class="go">[3, 2, 1, 4]</span>
       
   941 </pre></div>
       
   942 </div>
       
   943 <p>You can also set an ‘id’ function applied on each element:</p>
       
   944 <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>
       
   945 <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>
       
   946 <span class="go">[1, 2, 3, 4]</span>
       
   947 </pre></div>
       
   948 </div>
       
   949 </dd></dl>
       
   950 
       
   951 </div>
       
   952 <div class="section" id="module-pyams_utils.lock">
       
   953 <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>
       
   954 <dl class="class">
       
   955 <dt id="pyams_utils.lock.CacheLock">
       
   956 <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>
       
   957 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
   958 <p>Beaker based lock</p>
       
   959 <p>This lock can be used when you need to get a lot across several processes or even computers.
       
   960 The lock relies on a shared value stored into a shared Beaker cache.</p>
       
   961 <table class="docutils field-list" frame="void" rules="none">
       
   962 <col class="field-name" />
       
   963 <col class="field-body" />
       
   964 <tbody valign="top">
       
   965 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
   966 <li><strong>name</strong> (<em>str</em>) – name of the lock to use as shared key</li>
       
   967 <li><strong>wait</strong> (<em>boolean</em>) – if <em>False</em>, a <em>LockException</em> is raised if lock can’t be taken; otherwise,
       
   968 application waits until lock is released</li>
       
   969 </ul>
       
   970 </td>
       
   971 </tr>
       
   972 </tbody>
       
   973 </table>
       
   974 <p>Lock can be used as a context manager.</p>
       
   975 </dd></dl>
       
   976 
       
   977 <dl class="exception">
       
   978 <dt id="pyams_utils.lock.LockException">
       
   979 <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>
       
   980 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">Exception</span></code></p>
       
   981 <p>Cache lock exception</p>
       
   982 </dd></dl>
       
   983 
       
   984 <dl class="function">
       
   985 <dt id="pyams_utils.lock.get_locks_cache">
       
   986 <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>
       
   987 <dd><p>Get locks shared cache</p>
       
   988 </dd></dl>
       
   989 
       
   990 <dl class="function">
       
   991 <dt id="pyams_utils.lock.locked">
       
   992 <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>
       
   993 <dd><p>Locked function decorator</p>
       
   994 <p>Can be used with any function or method which requires a global shared lock.</p>
       
   995 <table class="docutils field-list" frame="void" rules="none">
       
   996 <col class="field-name" />
       
   997 <col class="field-body" />
       
   998 <tbody valign="top">
       
   999 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1000 <li><strong>name</strong> (<em>str</em>) – name of the lock to use as shared key</li>
       
  1001 <li><strong>wait</strong> (<em>boolean</em>) – if <em>False</em>, a <em>LockException</em> is raised if lock can’t be taken; otherwise,
       
  1002 application waits until lock is released</li>
       
  1003 </ul>
       
  1004 </td>
       
  1005 </tr>
       
  1006 </tbody>
       
  1007 </table>
       
  1008 </dd></dl>
       
  1009 
       
  1010 </div>
       
  1011 <div class="section" id="module-pyams_utils.progress">
       
  1012 <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>
       
  1013 <dl class="function">
       
  1014 <dt id="pyams_utils.progress.get_progress_cache">
       
  1015 <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>
       
  1016 <dd><p>Get cache storing tasks progress</p>
       
  1017 </dd></dl>
       
  1018 
       
  1019 <dl class="function">
       
  1020 <dt id="pyams_utils.progress.get_progress_status_view">
       
  1021 <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>
       
  1022 <dd><p>Get progress status of a given task</p>
       
  1023 <p>Each submitted task is identified by an ID defined when the task is created</p>
       
  1024 </dd></dl>
       
  1025 
       
  1026 <dl class="function">
       
  1027 <dt id="pyams_utils.progress.get_running_tasks">
       
  1028 <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>
       
  1029 <dd><p>Get list of running tasks</p>
       
  1030 </dd></dl>
       
  1031 
       
  1032 <dl class="function">
       
  1033 <dt id="pyams_utils.progress.get_tasks_cache">
       
  1034 <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>
       
  1035 <dd><p>Get cache storing tasks list</p>
       
  1036 </dd></dl>
       
  1037 
       
  1038 <dl class="function">
       
  1039 <dt id="pyams_utils.progress.set_running_tasks">
       
  1040 <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>
       
  1041 <dd><p>Update list of running tasks</p>
       
  1042 </dd></dl>
       
  1043 
       
  1044 </div>
       
  1045 <div class="section" id="module-pyams_utils.property">
       
  1046 <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>
       
  1047 <dl class="class">
       
  1048 <dt id="pyams_utils.property.DocFieldProperty">
       
  1049 <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>
       
  1050 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.fieldproperty.FieldProperty</span></code></p>
       
  1051 </dd></dl>
       
  1052 
       
  1053 <dl class="class">
       
  1054 <dt id="pyams_utils.property.cached">
       
  1055 <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>
       
  1056 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  1057 <p>Custom property decorator to define a property or function which is calculated only once</p>
       
  1058 <p>When applied on a function, caching is based on input arguments</p>
       
  1059 <dl class="method">
       
  1060 <dt id="pyams_utils.property.cached.expire">
       
  1061 <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>
       
  1062 <dd></dd></dl>
       
  1063 
       
  1064 </dd></dl>
       
  1065 
       
  1066 <dl class="class">
       
  1067 <dt id="pyams_utils.property.cached_property">
       
  1068 <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>
       
  1069 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  1070 <p>A read-only property decorator that is only evaluated once.</p>
       
  1071 <p>The value is cached on the object itself rather than the function or class; this should prevent
       
  1072 memory leakage.</p>
       
  1073 </dd></dl>
       
  1074 
       
  1075 <dl class="class">
       
  1076 <dt id="pyams_utils.property.classproperty">
       
  1077 <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>
       
  1078 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  1079 <p>Same decorator as property(), but passes obj.__class__ instead of obj to fget/fset/fdel.</p>
       
  1080 <p>Original code for property emulation:
       
  1081 <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>
       
  1082 <dl class="method">
       
  1083 <dt id="pyams_utils.property.classproperty.deleter">
       
  1084 <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>
       
  1085 <dd></dd></dl>
       
  1086 
       
  1087 <dl class="method">
       
  1088 <dt id="pyams_utils.property.classproperty.getter">
       
  1089 <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>
       
  1090 <dd></dd></dl>
       
  1091 
       
  1092 <dl class="method">
       
  1093 <dt id="pyams_utils.property.classproperty.setter">
       
  1094 <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>
       
  1095 <dd></dd></dl>
       
  1096 
       
  1097 </dd></dl>
       
  1098 
       
  1099 <dl class="function">
       
  1100 <dt id="pyams_utils.property.classproperty_support">
       
  1101 <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>
       
  1102 <dd><p>Class decorator to add metaclass to a class.</p>
       
  1103 <p>Metaclass uses to add descriptors to class attributes</p>
       
  1104 </dd></dl>
       
  1105 
       
  1106 </div>
       
  1107 <div class="section" id="module-pyams_utils.registry">
       
  1108 <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>
       
  1109 <p>Local registry management package</p>
       
  1110 <p>This package is used to manage <em>local registry</em>. A local registry is a <em>site management</em> component
       
  1111 created automatically on application startup by PyAMS_utils package. It can be used to store and register
       
  1112 components, mainly utilities which are created and configured dynamically by a site administrator; this can include
       
  1113 SQLAlchemy engines, ZEO connections, and several PyAMS utilities like security manager, medias converter,
       
  1114 tasks scheduler and many other ones.</p>
       
  1115 <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>
       
  1116 <dl class="class">
       
  1117 <dt id="pyams_utils.registry.LocalRegistry">
       
  1118 <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>
       
  1119 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">_thread._local</span></code></p>
       
  1120 <p>Local registry</p>
       
  1121 <dl class="method">
       
  1122 <dt id="pyams_utils.registry.LocalRegistry.get_registry">
       
  1123 <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>
       
  1124 <dd></dd></dl>
       
  1125 
       
  1126 <dl class="method">
       
  1127 <dt id="pyams_utils.registry.LocalRegistry.set_registry">
       
  1128 <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>
       
  1129 <dd></dd></dl>
       
  1130 
       
  1131 </dd></dl>
       
  1132 
       
  1133 <dl class="function">
       
  1134 <dt id="pyams_utils.registry.get_all_utilities_registered_for">
       
  1135 <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>
       
  1136 <dd><p>Get list of registered utilities for given interface</p>
       
  1137 <p>Do a registry lookup for matching utilities into local registry first, then on each registry
       
  1138 associated with current thread stack.</p>
       
  1139 </dd></dl>
       
  1140 
       
  1141 <dl class="function">
       
  1142 <dt id="pyams_utils.registry.get_current_registry">
       
  1143 <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>
       
  1144 <dd><p>Get current or global registry</p>
       
  1145 </dd></dl>
       
  1146 
       
  1147 <dl class="function">
       
  1148 <dt id="pyams_utils.registry.get_global_registry">
       
  1149 <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>
       
  1150 <dd><p>Get global registry</p>
       
  1151 </dd></dl>
       
  1152 
       
  1153 <dl class="function">
       
  1154 <dt id="pyams_utils.registry.get_local_registry">
       
  1155 <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>
       
  1156 <dd><p>Get local registry</p>
       
  1157 </dd></dl>
       
  1158 
       
  1159 <dl class="function">
       
  1160 <dt id="pyams_utils.registry.get_registries">
       
  1161 <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>
       
  1162 <dd><p>Iterator on components registries</p>
       
  1163 <p>Returns an iterator on current local registry (if any) and registries associated
       
  1164 in current thread stack.</p>
       
  1165 </dd></dl>
       
  1166 
       
  1167 <dl class="function">
       
  1168 <dt id="pyams_utils.registry.get_utilities_for">
       
  1169 <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>
       
  1170 <dd><p>Get utilities registered with given interface as (name, util) tuples iterator</p>
       
  1171 <p>Do a registry lookup for matching utilities into local registry first, then on each registry
       
  1172 associated with current thread stack.</p>
       
  1173 </dd></dl>
       
  1174 
       
  1175 <dl class="function">
       
  1176 <dt id="pyams_utils.registry.get_utility">
       
  1177 <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>
       
  1178 <dd><p>Get utility registered with given interface</p>
       
  1179 <p>Do a registry lookup for given utility into local registry first, then on each registry
       
  1180 associated with current thread stack.</p>
       
  1181 <table class="docutils field-list" frame="void" rules="none">
       
  1182 <col class="field-name" />
       
  1183 <col class="field-body" />
       
  1184 <tbody valign="top">
       
  1185 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  1186 <li><strong>provided</strong> (<em>Interface</em>) – the requested interface</li>
       
  1187 <li><strong>name</strong> (<em>str</em>) – name of the requested utility</li>
       
  1188 </ul>
       
  1189 </td>
       
  1190 </tr>
       
  1191 <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
       
  1192 can’t be found.</p>
       
  1193 </td>
       
  1194 </tr>
       
  1195 </tbody>
       
  1196 </table>
       
  1197 </dd></dl>
       
  1198 
       
  1199 <dl class="function">
       
  1200 <dt id="pyams_utils.registry.handle_new_request">
       
  1201 <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>
       
  1202 <dd><p>New request event subscriber</p>
       
  1203 <p>Is used to initialize local registry to None for any new request</p>
       
  1204 </dd></dl>
       
  1205 
       
  1206 <dl class="function">
       
  1207 <dt id="pyams_utils.registry.handle_site_before_traverse">
       
  1208 <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>
       
  1209 <dd><p>Before traverse event subscriber</p>
       
  1210 <p>Define site’s local registry when an object implementing ISite is traversed</p>
       
  1211 </dd></dl>
       
  1212 
       
  1213 <dl class="function">
       
  1214 <dt id="pyams_utils.registry.query_utility">
       
  1215 <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>
       
  1216 <dd><p>Query utility registered with given interface</p>
       
  1217 <p>Do a registry lookup for given utility into local registry first, then on each registry
       
  1218 associated with current thread stack.</p>
       
  1219 <table class="docutils field-list" frame="void" rules="none">
       
  1220 <col class="field-name" />
       
  1221 <col class="field-body" />
       
  1222 <tbody valign="top">
       
  1223 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  1224 <li><strong>provided</strong> (<em>Interface</em>) – the requested interface</li>
       
  1225 <li><strong>name</strong> (<em>str</em>) – name of the requested utility</li>
       
  1226 <li><strong>default</strong> (<em>object</em>) – the default object returned if the requested utility can’t be found</li>
       
  1227 </ul>
       
  1228 </td>
       
  1229 </tr>
       
  1230 <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>
       
  1231 </td>
       
  1232 </tr>
       
  1233 </tbody>
       
  1234 </table>
       
  1235 </dd></dl>
       
  1236 
       
  1237 <dl class="function">
       
  1238 <dt id="pyams_utils.registry.registered_utilities">
       
  1239 <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>
       
  1240 <dd><p>Get utilities registrations as generator</p>
       
  1241 <p>Iterates over utilities defined in all registries, starting with local ones.</p>
       
  1242 </dd></dl>
       
  1243 
       
  1244 <dl class="function">
       
  1245 <dt id="pyams_utils.registry.set_local_registry">
       
  1246 <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>
       
  1247 <dd><p>Define local registry</p>
       
  1248 </dd></dl>
       
  1249 
       
  1250 <dl class="class">
       
  1251 <dt id="pyams_utils.registry.utility_config">
       
  1252 <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>
       
  1253 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  1254 <p>Function or class decorator to register a utility in the global registry</p>
       
  1255 <table class="docutils field-list" frame="void" rules="none">
       
  1256 <col class="field-name" />
       
  1257 <col class="field-body" />
       
  1258 <tbody valign="top">
       
  1259 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1260 <li><strong>name</strong> (<em>str</em>) – default=’‘; name under which the utility is registered</li>
       
  1261 <li><strong>provides</strong> (<em>Interface</em>) – the interface for which the utility is registered</li>
       
  1262 </ul>
       
  1263 </td>
       
  1264 </tr>
       
  1265 </tbody>
       
  1266 </table>
       
  1267 <p>Please note that a single utility can be registered several times (using several annotations).</p>
       
  1268 <dl class="attribute">
       
  1269 <dt id="pyams_utils.registry.utility_config.venusian">
       
  1270 <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>
       
  1271 <dd></dd></dl>
       
  1272 
       
  1273 </dd></dl>
       
  1274 
       
  1275 </div>
       
  1276 <div class="section" id="module-pyams_utils.request">
       
  1277 <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>
       
  1278 <dl class="class">
       
  1279 <dt id="pyams_utils.request.PyAMSRequest">
       
  1280 <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>
       
  1281 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">pyramid.request.Request</span></code></p>
       
  1282 <p>Custom request factory</p>
       
  1283 <p>Used to add ‘context’ argument to ‘effective_principals’ method call
       
  1284 to be able to get ‘roles’ principals</p>
       
  1285 <dl class="method">
       
  1286 <dt id="pyams_utils.request.PyAMSRequest.has_permission">
       
  1287 <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>
       
  1288 <dd></dd></dl>
       
  1289 
       
  1290 </dd></dl>
       
  1291 
       
  1292 <dl class="function">
       
  1293 <dt id="pyams_utils.request.check_request">
       
  1294 <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>
       
  1295 <dd><p>Get current request, or create a new blank one if missing</p>
       
  1296 </dd></dl>
       
  1297 
       
  1298 <dl class="function">
       
  1299 <dt id="pyams_utils.request.get_annotations">
       
  1300 <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>
       
  1301 <dd><p>Define ‘annotations’ request property</p>
       
  1302 <p>This function is automatically defined as a custom request method on package include.</p>
       
  1303 </dd></dl>
       
  1304 
       
  1305 <dl class="function">
       
  1306 <dt id="pyams_utils.request.get_debug">
       
  1307 <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>
       
  1308 <dd><p>Define ‘debug’ request property</p>
       
  1309 <p>This function is automatically defined as a custom request method on package include.</p>
       
  1310 </dd></dl>
       
  1311 
       
  1312 <dl class="function">
       
  1313 <dt id="pyams_utils.request.get_request">
       
  1314 <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>
       
  1315 <dd><p>Get current request</p>
       
  1316 <p>Raises a NoInteraction exception if there is no active request.</p>
       
  1317 </dd></dl>
       
  1318 
       
  1319 <dl class="function">
       
  1320 <dt id="pyams_utils.request.get_request_data">
       
  1321 <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>
       
  1322 <dd><p>Get data associated with request</p>
       
  1323 <table class="docutils field-list" frame="void" rules="none">
       
  1324 <col class="field-name" />
       
  1325 <col class="field-body" />
       
  1326 <tbody valign="top">
       
  1327 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  1328 <li><strong>request</strong> – the request containing requested data</li>
       
  1329 <li><strong>key</strong> (<em>str</em>) – request data annotation key</li>
       
  1330 <li><strong>default</strong> (<em>object</em>) – the default value when data is missing</li>
       
  1331 </ul>
       
  1332 </td>
       
  1333 </tr>
       
  1334 <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>
       
  1335 </td>
       
  1336 </tr>
       
  1337 </tbody>
       
  1338 </table>
       
  1339 </dd></dl>
       
  1340 
       
  1341 <dl class="function">
       
  1342 <dt id="pyams_utils.request.query_request">
       
  1343 <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>
       
  1344 <dd><p>Query current request</p>
       
  1345 <p>Returns None if there is no active request</p>
       
  1346 </dd></dl>
       
  1347 
       
  1348 <dl class="function">
       
  1349 <dt id="pyams_utils.request.request_property">
       
  1350 <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>
       
  1351 <dd><p>Define a method decorator used to store result into current request’s annotations</p>
       
  1352 <p>If no request is currently running, a new one is created.
       
  1353 <cite>key</cite> is a required argument; if None, the key will be the method’s object</p>
       
  1354 <table class="docutils field-list" frame="void" rules="none">
       
  1355 <col class="field-name" />
       
  1356 <col class="field-body" />
       
  1357 <tbody valign="top">
       
  1358 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1359 <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
       
  1360 object, it will be called to get the actual session key</li>
       
  1361 <li><strong>prefix</strong> – str; prefix to use for session key; if <em>None</em>, the prefix will be the property name</li>
       
  1362 </ul>
       
  1363 </td>
       
  1364 </tr>
       
  1365 </tbody>
       
  1366 </table>
       
  1367 </dd></dl>
       
  1368 
       
  1369 <dl class="function">
       
  1370 <dt id="pyams_utils.request.set_request_data">
       
  1371 <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>
       
  1372 <dd><p>Associate data with request</p>
       
  1373 <table class="docutils field-list" frame="void" rules="none">
       
  1374 <col class="field-name" />
       
  1375 <col class="field-body" />
       
  1376 <tbody valign="top">
       
  1377 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1378 <li><strong>request</strong> – the request in which to set data</li>
       
  1379 <li><strong>key</strong> (<em>str</em>) – request data annotation key</li>
       
  1380 <li><strong>value</strong> (<em>object</em>) – the value to be set in request annotation</li>
       
  1381 </ul>
       
  1382 </td>
       
  1383 </tr>
       
  1384 </tbody>
       
  1385 </table>
       
  1386 </dd></dl>
       
  1387 
       
  1388 </div>
       
  1389 <div class="section" id="module-pyams_utils.schema">
       
  1390 <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>
       
  1391 <dl class="class">
       
  1392 <dt id="pyams_utils.schema.ColorField">
       
  1393 <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>
       
  1394 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapfields.TextLine</span></code></p>
       
  1395 <p>Color field</p>
       
  1396 </dd></dl>
       
  1397 
       
  1398 <dl class="class">
       
  1399 <dt id="pyams_utils.schema.DatesRangeField">
       
  1400 <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>
       
  1401 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.Tuple</span></code></p>
       
  1402 <p>Dates range field</p>
       
  1403 </dd></dl>
       
  1404 
       
  1405 <dl class="class">
       
  1406 <dt id="pyams_utils.schema.DottedDecimalField">
       
  1407 <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>
       
  1408 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.Decimal</span></code></p>
       
  1409 <p>Dotted decimal field</p>
       
  1410 </dd></dl>
       
  1411 
       
  1412 <dl class="class">
       
  1413 <dt id="pyams_utils.schema.EncodedPassword">
       
  1414 <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>
       
  1415 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapfields.Password</span></code></p>
       
  1416 <p>Encoded password field</p>
       
  1417 <dl class="method">
       
  1418 <dt id="pyams_utils.schema.EncodedPassword.constraint">
       
  1419 <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>
       
  1420 <dd></dd></dl>
       
  1421 
       
  1422 <dl class="method">
       
  1423 <dt id="pyams_utils.schema.EncodedPassword.fromUnicode">
       
  1424 <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>
       
  1425 <dd></dd></dl>
       
  1426 
       
  1427 </dd></dl>
       
  1428 
       
  1429 <dl class="class">
       
  1430 <dt id="pyams_utils.schema.HTMLField">
       
  1431 <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>
       
  1432 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapfields.Text</span></code></p>
       
  1433 <p>HTML field</p>
       
  1434 </dd></dl>
       
  1435 
       
  1436 <dl class="exception">
       
  1437 <dt id="pyams_utils.schema.InvalidEmail">
       
  1438 <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>
       
  1439 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapinterfaces.ValidationError</span></code></p>
       
  1440 <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>
       
  1441 </dd></dl>
       
  1442 
       
  1443 <dl class="class">
       
  1444 <dt id="pyams_utils.schema.MailAddressField">
       
  1445 <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>
       
  1446 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._bootstrapfields.TextLine</span></code></p>
       
  1447 <p>Mail address field</p>
       
  1448 </dd></dl>
       
  1449 
       
  1450 <dl class="class">
       
  1451 <dt id="pyams_utils.schema.PersistentDict">
       
  1452 <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>
       
  1453 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.Dict</span></code></p>
       
  1454 <p>Persistent mapping field</p>
       
  1455 </dd></dl>
       
  1456 
       
  1457 <dl class="class">
       
  1458 <dt id="pyams_utils.schema.PersistentList">
       
  1459 <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>
       
  1460 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.List</span></code></p>
       
  1461 <p>Persistent list field</p>
       
  1462 </dd></dl>
       
  1463 
       
  1464 <dl class="class">
       
  1465 <dt id="pyams_utils.schema.TextLineListField">
       
  1466 <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>
       
  1467 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema._field.List</span></code></p>
       
  1468 <p>TextLine list field</p>
       
  1469 </dd></dl>
       
  1470 
       
  1471 </div>
       
  1472 <div class="section" id="module-pyams_utils.session">
       
  1473 <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>
       
  1474 <dl class="function">
       
  1475 <dt id="pyams_utils.session.get_session_data">
       
  1476 <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>
       
  1477 <dd><p>Get data associated with current user session</p>
       
  1478 <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>
       
  1479 <table class="docutils field-list" frame="void" rules="none">
       
  1480 <col class="field-name" />
       
  1481 <col class="field-body" />
       
  1482 <tbody valign="top">
       
  1483 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1484 <li><strong>request</strong> – the request from which session is extracted</li>
       
  1485 <li><strong>app</strong> (<em>str</em>) – application name</li>
       
  1486 <li><strong>key</strong> (<em>str</em>) – session data key for given application</li>
       
  1487 <li><strong>default</strong> – object; requested session data, or <em>default</em> if it can’t be found</li>
       
  1488 </ul>
       
  1489 </td>
       
  1490 </tr>
       
  1491 </tbody>
       
  1492 </table>
       
  1493 <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>
       
  1494 <span class="n">SESSION_KEY</span> <span class="o">=</span> <span class="s1">&#39;MyFunction&#39;</span>
       
  1495 
       
  1496 <span class="k">def</span> <span class="nf">my_function</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
       
  1497     <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>
       
  1498 </pre></div>
       
  1499 </div>
       
  1500 </dd></dl>
       
  1501 
       
  1502 <dl class="function">
       
  1503 <dt id="pyams_utils.session.session_property">
       
  1504 <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>
       
  1505 <dd><p>Define a method decorator used to store result into request’s session</p>
       
  1506 <p>If no request is currently running, a new one is created.</p>
       
  1507 <table class="docutils field-list" frame="void" rules="none">
       
  1508 <col class="field-name" />
       
  1509 <col class="field-body" />
       
  1510 <tbody valign="top">
       
  1511 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1512 <li><strong>app</strong> (<em>str</em>) – application identifier used to prefix session keys</li>
       
  1513 <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
       
  1514 object, il will be called to get the actual session key</li>
       
  1515 <li><strong>prefix</strong> – str; prefix to use for session key; if <em>None</em>, the prefix will be the property name</li>
       
  1516 </ul>
       
  1517 </td>
       
  1518 </tr>
       
  1519 </tbody>
       
  1520 </table>
       
  1521 </dd></dl>
       
  1522 
       
  1523 <dl class="function">
       
  1524 <dt id="pyams_utils.session.set_session_data">
       
  1525 <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>
       
  1526 <dd><p>Associate data with current user session</p>
       
  1527 <table class="docutils field-list" frame="void" rules="none">
       
  1528 <col class="field-name" />
       
  1529 <col class="field-body" />
       
  1530 <tbody valign="top">
       
  1531 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1532 <li><strong>request</strong> – the request from which session is extracted</li>
       
  1533 <li><strong>app</strong> (<em>str</em>) – application name</li>
       
  1534 <li><strong>key</strong> (<em>str</em>) – session data key for given application</li>
       
  1535 <li><strong>value</strong> (<em>object</em>) – any object that can be pickled can be stored into user session</li>
       
  1536 </ul>
       
  1537 </td>
       
  1538 </tr>
       
  1539 </tbody>
       
  1540 </table>
       
  1541 <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>
       
  1542 <span class="n">SESSION_KEY</span> <span class="o">=</span> <span class="s1">&#39;MyFunction&#39;</span>
       
  1543 
       
  1544 <span class="k">def</span> <span class="nf">my_function</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
       
  1545     <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>
       
  1546     <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>
       
  1547 </pre></div>
       
  1548 </div>
       
  1549 </dd></dl>
       
  1550 
       
  1551 </div>
       
  1552 <div class="section" id="module-pyams_utils.site">
       
  1553 <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>
       
  1554 <dl class="class">
       
  1555 <dt id="pyams_utils.site.BaseSiteRoot">
       
  1556 <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>
       
  1557 <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>
       
  1558 <p>Default site root</p>
       
  1559 <p>A site root can be used as base application root in your ZODB.
       
  1560 It’s also site root responsibility to manage your local site manager.</p>
       
  1561 <p>BaseSiteRoot defines a basic ACL which gives all permissions to system administrator.</p>
       
  1562 <dl class="attribute">
       
  1563 <dt id="pyams_utils.site.BaseSiteRoot.config_klass">
       
  1564 <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>
       
  1565 <dd></dd></dl>
       
  1566 
       
  1567 </dd></dl>
       
  1568 
       
  1569 <dl class="class">
       
  1570 <dt id="pyams_utils.site.NewLocalSiteCreatedEvent">
       
  1571 <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>
       
  1572 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.interface.interfaces.ObjectEvent</span></code></p>
       
  1573 <p>New local site creation event</p>
       
  1574 </dd></dl>
       
  1575 
       
  1576 <dl class="class">
       
  1577 <dt id="pyams_utils.site.SiteRootEtcTraverser">
       
  1578 <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>
       
  1579 <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>
       
  1580 <p>Site root ++etc++ namespace traverser</p>
       
  1581 <p>Gives access to local site manager from <em>/++etc++site</em> URL</p>
       
  1582 <dl class="method">
       
  1583 <dt id="pyams_utils.site.SiteRootEtcTraverser.traverse">
       
  1584 <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>
       
  1585 <dd></dd></dl>
       
  1586 
       
  1587 </dd></dl>
       
  1588 
       
  1589 <dl class="class">
       
  1590 <dt id="pyams_utils.site.SiteUpgradeEvent">
       
  1591 <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>
       
  1592 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.interface.interfaces.ObjectEvent</span></code></p>
       
  1593 <p>Site upgrade request event</p>
       
  1594 </dd></dl>
       
  1595 
       
  1596 <dl class="function">
       
  1597 <dt id="pyams_utils.site.check_required_utilities">
       
  1598 <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>
       
  1599 <dd><p>Utility function to check for required utilities</p>
       
  1600 <table class="docutils field-list" frame="void" rules="none">
       
  1601 <col class="field-name" />
       
  1602 <col class="field-body" />
       
  1603 <tbody valign="top">
       
  1604 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1605 <li><strong>site</strong> (<em>object</em>) – the site manager into which configuration may be checked</li>
       
  1606 <li><strong>utilities</strong> (<em>tuple</em>) – each element of the tuple is another tuple made of the utility interface,
       
  1607 the utility registration name, the utility factory and the object name when creating the utility, as in:</li>
       
  1608 </ul>
       
  1609 </td>
       
  1610 </tr>
       
  1611 </tbody>
       
  1612 </table>
       
  1613 <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>
       
  1614                       <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>
       
  1615 </pre></div>
       
  1616 </div>
       
  1617 </dd></dl>
       
  1618 
       
  1619 <dl class="function">
       
  1620 <dt id="pyams_utils.site.site_factory">
       
  1621 <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>
       
  1622 <dd><p>Application site factory</p>
       
  1623 <p>On application startup, this factory checks configuration to get application name and
       
  1624 load it from the ZODB; if the application can’t be found, configuration is scanned to
       
  1625 get application factory, create a new one and create a local site manager.</p>
       
  1626 </dd></dl>
       
  1627 
       
  1628 <dl class="function">
       
  1629 <dt id="pyams_utils.site.site_upgrade">
       
  1630 <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>
       
  1631 <dd><p>Upgrade site when needed</p>
       
  1632 <p>This function is executed by <em>pyams_upgrade</em> console script.
       
  1633 Site generations are registered named utilities providing
       
  1634 <code class="xref py py-class docutils literal"><span class="pre">ISiteGenerations</span></code> interface.</p>
       
  1635 <p>Current site generations are stored into annotations for each generation adapter.</p>
       
  1636 </dd></dl>
       
  1637 
       
  1638 </div>
       
  1639 <div class="section" id="module-pyams_utils.size">
       
  1640 <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>
       
  1641 <dl class="function">
       
  1642 <dt id="pyams_utils.size.get_human_size">
       
  1643 <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>
       
  1644 <dd><p>Convert given bytes value in human readable format</p>
       
  1645 <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>
       
  1646 <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>
       
  1647 <span class="gp">&gt;&gt;&gt; </span><span class="n">request</span><span class="o">.</span><span class="n">locale_name</span>
       
  1648 <span class="go">&#39;en&#39;</span>
       
  1649 <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>
       
  1650 <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>
       
  1651 <span class="go">&#39;256 bytes&#39;</span>
       
  1652 <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>
       
  1653 <span class="go">&#39;3.6 Kb&#39;</span>
       
  1654 <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>
       
  1655 <span class="go">&#39;6.47 Mb&#39;</span>
       
  1656 <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>
       
  1657 <span class="go">&#39;3.422 Gb&#39;</span>
       
  1658 <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>
       
  1659 <span class="gp">&gt;&gt;&gt; </span><span class="n">request</span><span class="o">.</span><span class="n">locale_name</span>
       
  1660 <span class="go">&#39;fr&#39;</span>
       
  1661 <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>
       
  1662 <span class="go">&#39;256 bytes&#39;</span>
       
  1663 <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>
       
  1664 <span class="go">&#39;3,6 Kb&#39;</span>
       
  1665 <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>
       
  1666 <span class="go">&#39;6,47 Mb&#39;</span>
       
  1667 <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>
       
  1668 <span class="go">&#39;3,422 Gb&#39;</span>
       
  1669 </pre></div>
       
  1670 </div>
       
  1671 </dd></dl>
       
  1672 
       
  1673 </div>
       
  1674 <div class="section" id="module-pyams_utils.tales">
       
  1675 <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>
       
  1676 <dl class="class">
       
  1677 <dt id="pyams_utils.tales.ContextExprMixin">
       
  1678 <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>
       
  1679 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  1680 <p>Mixin-class for expression compilers</p>
       
  1681 <dl class="attribute">
       
  1682 <dt id="pyams_utils.tales.ContextExprMixin.transform">
       
  1683 <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>
       
  1684 <dd></dd></dl>
       
  1685 
       
  1686 </dd></dl>
       
  1687 
       
  1688 <dl class="class">
       
  1689 <dt id="pyams_utils.tales.ExtensionExpr">
       
  1690 <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>
       
  1691 <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>
       
  1692 <p>extension: TALES expression</p>
       
  1693 <p>This expression can be used to call a custom named adapter providing ITALESExtension interface.</p>
       
  1694 <dl class="attribute">
       
  1695 <dt id="pyams_utils.tales.ExtensionExpr.transform">
       
  1696 <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>
       
  1697 <dd></dd></dl>
       
  1698 
       
  1699 </dd></dl>
       
  1700 
       
  1701 <dl class="function">
       
  1702 <dt id="pyams_utils.tales.render_extension">
       
  1703 <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>
       
  1704 <dd><p>TALES extension renderer</p>
       
  1705 <p>See <a class="reference internal" href="tales.html#tales"><span class="std std-ref">Custom TALES extensions</span></a> for complete description.</p>
       
  1706 </dd></dl>
       
  1707 
       
  1708 </div>
       
  1709 <div class="section" id="module-pyams_utils.text">
       
  1710 <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>
       
  1711 <dl class="class">
       
  1712 <dt id="pyams_utils.text.BaseHTMLRenderer">
       
  1713 <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>
       
  1714 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  1715 <p>Raw text HTML renderer</p>
       
  1716 <p>This renderer renders input text ‘as is’, mainly for use in a &lt;pre&gt; tag.</p>
       
  1717 <dl class="method">
       
  1718 <dt id="pyams_utils.text.BaseHTMLRenderer.render">
       
  1719 <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>
       
  1720 <dd></dd></dl>
       
  1721 
       
  1722 </dd></dl>
       
  1723 
       
  1724 <dl class="class">
       
  1725 <dt id="pyams_utils.text.HTMLTalesExtension">
       
  1726 <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>
       
  1727 <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>
       
  1728 <p><em>extension:html</em> TALES expression</p>
       
  1729 <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>
       
  1730 adapter can be found, this adapter is used to render the context to HTML; if <em>context</em> is a string,
       
  1731 it is converted to HTML using the renderer defined as second parameter; otherwise, context is just
       
  1732 converted to string using the <code class="xref py py-func docutils literal"><span class="pre">str()</span></code> function.</p>
       
  1733 <dl class="method">
       
  1734 <dt id="pyams_utils.text.HTMLTalesExtension.render">
       
  1735 <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>
       
  1736 <dd></dd></dl>
       
  1737 
       
  1738 </dd></dl>
       
  1739 
       
  1740 <dl class="class">
       
  1741 <dt id="pyams_utils.text.ReStructuredTextRenderer">
       
  1742 <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>
       
  1743 <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>
       
  1744 <p>reStructuredText HTML renderer</p>
       
  1745 <p>This renderer is using <em>docutils</em> to render HTML output.</p>
       
  1746 <dl class="method">
       
  1747 <dt id="pyams_utils.text.ReStructuredTextRenderer.render">
       
  1748 <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>
       
  1749 <dd><p>Render reStructuredText to HTML</p>
       
  1750 </dd></dl>
       
  1751 
       
  1752 </dd></dl>
       
  1753 
       
  1754 <dl class="class">
       
  1755 <dt id="pyams_utils.text.RenderersVocabulary">
       
  1756 <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>
       
  1757 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.vocabulary.SimpleVocabulary</span></code></p>
       
  1758 <p>Text renderers vocabulary</p>
       
  1759 </dd></dl>
       
  1760 
       
  1761 <dl class="class">
       
  1762 <dt id="pyams_utils.text.TextRenderer">
       
  1763 <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>
       
  1764 <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>
       
  1765 <p>Basic text HTML renderer</p>
       
  1766 <p>This renderer only replace newlines with HTML breaks.</p>
       
  1767 <dl class="method">
       
  1768 <dt id="pyams_utils.text.TextRenderer.render">
       
  1769 <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>
       
  1770 <dd></dd></dl>
       
  1771 
       
  1772 </dd></dl>
       
  1773 
       
  1774 <dl class="function">
       
  1775 <dt id="pyams_utils.text.get_text_start">
       
  1776 <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>
       
  1777 <dd><p>Get first words of given text with maximum given length</p>
       
  1778 <p>If <em>max</em> is specified, text is shortened only if remaining text is longer this value</p>
       
  1779 <table class="docutils field-list" frame="void" rules="none">
       
  1780 <col class="field-name" />
       
  1781 <col class="field-body" />
       
  1782 <tbody valign="top">
       
  1783 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1784 <li><strong>text</strong> (<em>str</em>) – initial text</li>
       
  1785 <li><strong>length</strong> (<em>integer</em>) – maximum length of resulting text</li>
       
  1786 <li><strong>max</strong> (<em>integer</em>) – if &gt; 0, <em>text</em> is shortened only if remaining text is longer than max</li>
       
  1787 </ul>
       
  1788 </td>
       
  1789 </tr>
       
  1790 </tbody>
       
  1791 </table>
       
  1792 <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>
       
  1793 <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>
       
  1794 <span class="go">&#39;This is a&amp;#133;&#39;</span>
       
  1795 <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>
       
  1796 <span class="go">&#39;This is a long&amp;#133;&#39;</span>
       
  1797 <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>
       
  1798 <span class="go">&#39;This is a long string&#39;</span>
       
  1799 </pre></div>
       
  1800 </div>
       
  1801 </dd></dl>
       
  1802 
       
  1803 <dl class="function">
       
  1804 <dt id="pyams_utils.text.text_to_html">
       
  1805 <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>
       
  1806 <dd><p>Convert text to HTML using the given renderer</p>
       
  1807 <p>Renderer name can be any registered HTML renderer adapter</p>
       
  1808 </dd></dl>
       
  1809 
       
  1810 </div>
       
  1811 <div class="section" id="module-pyams_utils.traversing">
       
  1812 <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>
       
  1813 <dl class="class">
       
  1814 <dt id="pyams_utils.traversing.NamespaceTraverser">
       
  1815 <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>
       
  1816 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">pyramid.traversal.ResourceTreeTraverser</span></code></p>
       
  1817 <p>Custom traverser handling views and namespaces</p>
       
  1818 <p>This is an upgraded version of native Pyramid traverser.
       
  1819 It adds:
       
  1820 - a new BeforeTraverseEvent before traversing each object in the path
       
  1821 - support for namespaces with “++” notation</p>
       
  1822 <dl class="attribute">
       
  1823 <dt id="pyams_utils.traversing.NamespaceTraverser.NAMESPACE_SELECTOR">
       
  1824 <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>
       
  1825 <dd></dd></dl>
       
  1826 
       
  1827 </dd></dl>
       
  1828 
       
  1829 <dl class="class">
       
  1830 <dt id="pyams_utils.traversing.PathElementsAdapter">
       
  1831 <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>
       
  1832 <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>
       
  1833 <p>Contained object path elements adapter</p>
       
  1834 <p>This interface is intended to be used inside a keyword index to
       
  1835 be able to search object based on a given parent</p>
       
  1836 <dl class="attribute">
       
  1837 <dt id="pyams_utils.traversing.PathElementsAdapter.parents">
       
  1838 <code class="descname">parents</code><a class="headerlink" href="#pyams_utils.traversing.PathElementsAdapter.parents" title="Permalink to this definition">¶</a></dt>
       
  1839 <dd></dd></dl>
       
  1840 
       
  1841 </dd></dl>
       
  1842 
       
  1843 <dl class="function">
       
  1844 <dt id="pyams_utils.traversing.get_parent">
       
  1845 <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>
       
  1846 <dd><p>Get first parent of the context that implements given interface</p>
       
  1847 <table class="docutils field-list" frame="void" rules="none">
       
  1848 <col class="field-name" />
       
  1849 <col class="field-body" />
       
  1850 <tbody valign="top">
       
  1851 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  1852 <li><strong>context</strong> (<em>object</em>) – base element</li>
       
  1853 <li><strong>interface</strong> (<em>Interface</em>) – the interface that parend should implement</li>
       
  1854 <li><strong>allow_context</strong> (<em>boolean</em>) – if ‘True’ (the default), traversing is done starting with context; otherwise,
       
  1855 traversing is done starting from context’s parent</li>
       
  1856 <li><strong>condition</strong> (<em>callable</em>) – an optional function that should return a ‘True’ result when called with parent
       
  1857 as first argument</li>
       
  1858 </ul>
       
  1859 </td>
       
  1860 </tr>
       
  1861 </tbody>
       
  1862 </table>
       
  1863 </dd></dl>
       
  1864 
       
  1865 </div>
       
  1866 <div class="section" id="module-pyams_utils.unicode">
       
  1867 <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>
       
  1868 <dl class="function">
       
  1869 <dt id="pyams_utils.unicode.decode">
       
  1870 <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>
       
  1871 <dd><p>Decode given bytes value to unicode with given encoding</p>
       
  1872 <table class="docutils field-list" frame="void" rules="none">
       
  1873 <col class="field-name" />
       
  1874 <col class="field-body" />
       
  1875 <tbody valign="top">
       
  1876 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  1877 <li><strong>value</strong> (<em>bytes</em>) – the value to decode</li>
       
  1878 <li><strong>encoding</strong> (<em>str</em>) – selected encoding</li>
       
  1879 </ul>
       
  1880 </td>
       
  1881 </tr>
       
  1882 <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>
       
  1883 </td>
       
  1884 </tr>
       
  1885 </tbody>
       
  1886 </table>
       
  1887 <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>
       
  1888 <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>
       
  1889 <span class="go">&#39;Chaîne accentuée&#39;</span>
       
  1890 <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>
       
  1891 <span class="go">&#39;Chaîne accentuée&#39;</span>
       
  1892 </pre></div>
       
  1893 </div>
       
  1894 </dd></dl>
       
  1895 
       
  1896 <dl class="function">
       
  1897 <dt id="pyams_utils.unicode.encode">
       
  1898 <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>
       
  1899 <dd><p>Encode given Unicode value to bytes with given encoding</p>
       
  1900 <table class="docutils field-list" frame="void" rules="none">
       
  1901 <col class="field-name" />
       
  1902 <col class="field-body" />
       
  1903 <tbody valign="top">
       
  1904 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  1905 <li><strong>value</strong> (<em>str</em>) – the value to encode</li>
       
  1906 <li><strong>encoding</strong> (<em>str</em>) – selected encoding</li>
       
  1907 </ul>
       
  1908 </td>
       
  1909 </tr>
       
  1910 <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>
       
  1911 </td>
       
  1912 </tr>
       
  1913 </tbody>
       
  1914 </table>
       
  1915 <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>
       
  1916 <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>
       
  1917 <span class="go">b&#39;Cha\xc3\xaene accentu\xc3\xa9e&#39;</span>
       
  1918 <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>
       
  1919 <span class="go">b&#39;Cha\xeene accentu\xe9e&#39;</span>
       
  1920 </pre></div>
       
  1921 </div>
       
  1922 </dd></dl>
       
  1923 
       
  1924 <dl class="function">
       
  1925 <dt id="pyams_utils.unicode.nvl">
       
  1926 <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>
       
  1927 <dd><p>Get specified value, or an empty string if value is empty</p>
       
  1928 <table class="docutils field-list" frame="void" rules="none">
       
  1929 <col class="field-name" />
       
  1930 <col class="field-body" />
       
  1931 <tbody valign="top">
       
  1932 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  1933 <li><strong>value</strong> (<em>object</em>) – value to be checked</li>
       
  1934 <li><strong>default</strong> (<em>object</em>) – default value to be returned if value is <em>false</em></li>
       
  1935 </ul>
       
  1936 </td>
       
  1937 </tr>
       
  1938 <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>
       
  1939 </td>
       
  1940 </tr>
       
  1941 </tbody>
       
  1942 </table>
       
  1943 <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>
       
  1944 <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>
       
  1945 <span class="go">&#39;&#39;</span>
       
  1946 <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>
       
  1947 <span class="go">&#39;foo&#39;</span>
       
  1948 <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>
       
  1949 <span class="go">&#39;bar&#39;</span>
       
  1950 </pre></div>
       
  1951 </div>
       
  1952 </dd></dl>
       
  1953 
       
  1954 <dl class="function">
       
  1955 <dt id="pyams_utils.unicode.translate_string">
       
  1956 <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>
       
  1957 <dd><p>Remove extended characters and diacritics from string and replace them with ‘basic’ ones</p>
       
  1958 <table class="docutils field-list" frame="void" rules="none">
       
  1959 <col class="field-name" />
       
  1960 <col class="field-body" />
       
  1961 <tbody valign="top">
       
  1962 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  1963 <li><strong>s</strong> (<em>str</em>) – text to be cleaned.</li>
       
  1964 <li><strong>escape_slashes</strong> (<em>boolean</em>) – if True, slashes are also converted</li>
       
  1965 <li><strong>force_lower</strong> (<em>boolean</em>) – if True, result is automatically converted to lower case</li>
       
  1966 <li><strong>spaces</strong> (<em>str</em>) – character used to replace spaces</li>
       
  1967 <li><strong>remove_punctuation</strong> (<em>boolean</em>) – if True, all punctuation characters are removed</li>
       
  1968 <li><strong>keep_chars</strong> (<em>str</em>) – characters which may be kept in the input string</li>
       
  1969 </ul>
       
  1970 </td>
       
  1971 </tr>
       
  1972 <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>
       
  1973 </td>
       
  1974 </tr>
       
  1975 </tbody>
       
  1976 </table>
       
  1977 <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>
       
  1978 <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>
       
  1979 <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>
       
  1980 <span class="go">&#39;ceci est un test en francais&#39;</span>
       
  1981 <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>
       
  1982 <span class="go">&#39;Ceci est un test en Francais&#39;</span>
       
  1983 <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>
       
  1984 <span class="go">&#39;ceci-est-un-test-en-francais&#39;</span>
       
  1985 <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>
       
  1986 <span class="go">&#39;ceci est un test en francais !!!&#39;</span>
       
  1987 <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>
       
  1988 <span class="go">&#39;ceci est un test en francais !!!&#39;</span>
       
  1989 </pre></div>
       
  1990 </div>
       
  1991 </dd></dl>
       
  1992 
       
  1993 <dl class="function">
       
  1994 <dt id="pyams_utils.unicode.unidict">
       
  1995 <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>
       
  1996 <dd><p>Get specified dict with values converted to unicode</p>
       
  1997 <table class="docutils field-list" frame="void" rules="none">
       
  1998 <col class="field-name" />
       
  1999 <col class="field-body" />
       
  2000 <tbody valign="top">
       
  2001 <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>
       
  2002 </tr>
       
  2003 <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>
       
  2004 </tr>
       
  2005 </tbody>
       
  2006 </table>
       
  2007 <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>
       
  2008 <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>
       
  2009 <span class="go">{&#39;input&#39;: &#39;Chaîne accentuée&#39;}</span>
       
  2010 <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>
       
  2011 <span class="go">{&#39;input&#39;: &#39;Chaîne accentuée&#39;}</span>
       
  2012 </pre></div>
       
  2013 </div>
       
  2014 </dd></dl>
       
  2015 
       
  2016 <dl class="function">
       
  2017 <dt id="pyams_utils.unicode.unilist">
       
  2018 <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>
       
  2019 <dd><p>Get specified list with values converted to unicode</p>
       
  2020 <table class="docutils field-list" frame="void" rules="none">
       
  2021 <col class="field-name" />
       
  2022 <col class="field-body" />
       
  2023 <tbody valign="top">
       
  2024 <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>
       
  2025 </tr>
       
  2026 <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>
       
  2027 </tr>
       
  2028 </tbody>
       
  2029 </table>
       
  2030 <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>
       
  2031 <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>
       
  2032 <span class="go">[&#39;Chaîne accentuée&#39;]</span>
       
  2033 <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>
       
  2034 <span class="go">[&#39;Chaîne accentuée&#39;]</span>
       
  2035 </pre></div>
       
  2036 </div>
       
  2037 </dd></dl>
       
  2038 
       
  2039 <dl class="function">
       
  2040 <dt id="pyams_utils.unicode.uninvl">
       
  2041 <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>
       
  2042 <dd><p>Get specified value converted to unicode, or an empty unicode string if value is empty</p>
       
  2043 <table class="docutils field-list" frame="void" rules="none">
       
  2044 <col class="field-name" />
       
  2045 <col class="field-body" />
       
  2046 <tbody valign="top">
       
  2047 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  2048 <li><strong>value</strong> (<em>str/bytes</em>) – the input to be checked</li>
       
  2049 <li><strong>default</strong> – str; default value</li>
       
  2050 <li><strong>encoding</strong> – str; encoding name to use for conversion</li>
       
  2051 </ul>
       
  2052 </td>
       
  2053 </tr>
       
  2054 <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>
       
  2055 </td>
       
  2056 </tr>
       
  2057 </tbody>
       
  2058 </table>
       
  2059 <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>
       
  2060 <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>
       
  2061 <span class="go">&#39;String value&#39;</span>
       
  2062 <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>
       
  2063 <span class="go">&#39;String value&#39;</span>
       
  2064 <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>
       
  2065 <span class="go">&#39;Chaîne accentuée&#39;</span>
       
  2066 <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>
       
  2067 <span class="go">&#39;Chaîne accentuée&#39;</span>
       
  2068 </pre></div>
       
  2069 </div>
       
  2070 </dd></dl>
       
  2071 
       
  2072 <dl class="function">
       
  2073 <dt id="pyams_utils.unicode.utf8">
       
  2074 <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>
       
  2075 <dd><p>Encode given unicode value to UTF-8 encoded bytes</p>
       
  2076 <table class="docutils field-list" frame="void" rules="none">
       
  2077 <col class="field-name" />
       
  2078 <col class="field-body" />
       
  2079 <tbody valign="top">
       
  2080 <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>
       
  2081 </tr>
       
  2082 <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>
       
  2083 </tr>
       
  2084 </tbody>
       
  2085 </table>
       
  2086 <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>
       
  2087 <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>
       
  2088 <span class="go">b&#39;Cha\xc3\xaene accentu\xc3\xa9e&#39;</span>
       
  2089 </pre></div>
       
  2090 </div>
       
  2091 </dd></dl>
       
  2092 
       
  2093 </div>
       
  2094 <div class="section" id="module-pyams_utils.url">
       
  2095 <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>
       
  2096 <dl class="class">
       
  2097 <dt id="pyams_utils.url.AbsoluteUrlTalesExtension">
       
  2098 <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>
       
  2099 <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>
       
  2100 <p>extension:absolute_url(context, view_name) TALES extension</p>
       
  2101 <p>A PyAMS TALES extension used to get access to an object URL from a page template.</p>
       
  2102 <dl class="method">
       
  2103 <dt id="pyams_utils.url.AbsoluteUrlTalesExtension.render">
       
  2104 <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>
       
  2105 <dd></dd></dl>
       
  2106 
       
  2107 </dd></dl>
       
  2108 
       
  2109 <dl class="function">
       
  2110 <dt id="pyams_utils.url.absolute_url">
       
  2111 <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>
       
  2112 <dd><p>Get resource absolute_url</p>
       
  2113 <table class="docutils field-list" frame="void" rules="none">
       
  2114 <col class="field-name" />
       
  2115 <col class="field-body" />
       
  2116 <tbody valign="top">
       
  2117 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
       
  2118 <li><strong>context</strong> (<em>object</em>) – the persistent object for which absolute URL is required</li>
       
  2119 <li><strong>request</strong> – the request on which URL is based</li>
       
  2120 <li><strong>view_name</strong> (<em>str</em>) – an optional view name to add to URL</li>
       
  2121 <li><strong>query</strong> (<em>str/dict</em>) – an optional URL arguments string or mapping</li>
       
  2122 </ul>
       
  2123 </td>
       
  2124 </tr>
       
  2125 </tbody>
       
  2126 </table>
       
  2127 <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
       
  2128 add checks to remove some double slashes, and add control on view name when it begins with a ‘#’
       
  2129 character which is used by MyAMS.js framework.</p>
       
  2130 </dd></dl>
       
  2131 
       
  2132 </div>
       
  2133 <div class="section" id="module-pyams_utils.vocabulary">
       
  2134 <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>
       
  2135 <dl class="class">
       
  2136 <dt id="pyams_utils.vocabulary.vocabulary_config">
       
  2137 <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>
       
  2138 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  2139 <p>Class decorator to define a vocabulary</p>
       
  2140 <table class="docutils field-list" frame="void" rules="none">
       
  2141 <col class="field-name" />
       
  2142 <col class="field-body" />
       
  2143 <tbody valign="top">
       
  2144 <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>
       
  2145 </tr>
       
  2146 </tbody>
       
  2147 </table>
       
  2148 <p>This is, for example, how a vocabulary of registered ZEO connections utilities is created:</p>
       
  2149 <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>
       
  2150 
       
  2151 <span class="kn">from</span> <span class="nn">pyams_utils.registry</span> <span class="kn">import</span> <span class="n">get_utilities_for</span>
       
  2152 <span class="kn">from</span> <span class="nn">pyams_utils.vocabulary</span> <span class="kn">import</span> <span class="n">vocabulary_config</span>
       
  2153 <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>
       
  2154 
       
  2155 <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>
       
  2156 <span class="k">class</span> <span class="nc">ZEOConnectionVocabulary</span><span class="p">(</span><span class="n">SimpleVocabulary</span><span class="p">):</span>
       
  2157     <span class="sd">&#39;&#39;&#39;ZEO connections vocabulary&#39;&#39;&#39;</span>
       
  2158 
       
  2159     <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>
       
  2160         <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>
       
  2161         <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>
       
  2162 </pre></div>
       
  2163 </div>
       
  2164 <p>You can then use such a vocabulary in any schema field:</p>
       
  2165 <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>
       
  2166 <span class="kn">from</span> <span class="nn">zope.schema</span> <span class="kn">import</span> <span class="n">Choice</span>
       
  2167 
       
  2168 <span class="k">class</span> <span class="nc">MySchema</span><span class="p">(</span><span class="n">Interface</span><span class="p">):</span>
       
  2169     <span class="sd">&#39;&#39;&#39;Custom schema interface&#39;&#39;&#39;</span>
       
  2170 
       
  2171     <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>
       
  2172                                  <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>
       
  2173                                  <span class="n">vocabulary</span><span class="o">=</span><span class="s1">&#39;PyAMS ZEO connections&#39;</span><span class="p">,</span>
       
  2174                                  <span class="n">required</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
       
  2175 </pre></div>
       
  2176 </div>
       
  2177 </dd></dl>
       
  2178 
       
  2179 </div>
       
  2180 <div class="section" id="module-pyams_utils.wsgi">
       
  2181 <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>
       
  2182 <dl class="function">
       
  2183 <dt id="pyams_utils.wsgi.wsgi_environ_cache">
       
  2184 <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>
       
  2185 <dd><p>Wrap a function/method to cache its result for call into request.environ</p>
       
  2186 <table class="docutils field-list" frame="void" rules="none">
       
  2187 <col class="field-name" />
       
  2188 <col class="field-body" />
       
  2189 <tbody valign="top">
       
  2190 <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
       
  2191 be equal to the result’s length or scalar</td>
       
  2192 </tr>
       
  2193 </tbody>
       
  2194 </table>
       
  2195 </dd></dl>
       
  2196 
       
  2197 </div>
       
  2198 <div class="section" id="module-pyams_utils.zodb">
       
  2199 <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>
       
  2200 <dl class="class">
       
  2201 <dt id="pyams_utils.zodb.ZEOConnection">
       
  2202 <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>
       
  2203 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  2204 <p>ZEO connection object</p>
       
  2205 <p>This object can be used to store all settings to be able to open a ZEO connection.
       
  2206 Note that this class is required only for tasks specifically targeting a ZEO database connection (like a ZEO
       
  2207 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
       
  2208 Pyramid’s configuration file.</p>
       
  2209 <p>Note that a ZEO connection object is a context manager, so you can use it like this:</p>
       
  2210 <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>
       
  2211 
       
  2212 <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>
       
  2213     <span class="n">zeo_connection</span> <span class="o">=</span> <span class="n">ZEOConnection</span><span class="p">()</span>
       
  2214     <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>
       
  2215     <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>
       
  2216         <span class="c1"># *root* is then the ZODB root object</span>
       
  2217         <span class="c1"># do whatever you want with ZEO connection,</span>
       
  2218         <span class="c1"># which is closed automatically</span>
       
  2219 </pre></div>
       
  2220 </div>
       
  2221 <dl class="attribute">
       
  2222 <dt id="pyams_utils.zodb.ZEOConnection.blob_dir">
       
  2223 <code class="descname">blob_dir</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.blob_dir" title="Permalink to this definition">¶</a></dt>
       
  2224 <dd><p>BLOBs directory: Directory path for blob data</p>
       
  2225 </dd></dl>
       
  2226 
       
  2227 <dl class="attribute">
       
  2228 <dt id="pyams_utils.zodb.ZEOConnection.connection">
       
  2229 <code class="descname">connection</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.connection" title="Permalink to this definition">¶</a></dt>
       
  2230 <dd></dd></dl>
       
  2231 
       
  2232 <dl class="method">
       
  2233 <dt id="pyams_utils.zodb.ZEOConnection.get_connection">
       
  2234 <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>
       
  2235 <dd><p>Create ZEO client connection from current settings</p>
       
  2236 <table class="docutils field-list" frame="void" rules="none">
       
  2237 <col class="field-name" />
       
  2238 <col class="field-body" />
       
  2239 <tbody valign="top">
       
  2240 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
       
  2241 <li><strong>wait</strong> (<em>boolean</em>) – should connection wait until storage is ready</li>
       
  2242 <li><strong>get_storage</strong> (<em>boolean</em>) – if <em>True</em>, the method should return a tuple containing
       
  2243 storage and DB objects; otherwise only DB object is returned</li>
       
  2244 </ul>
       
  2245 </td>
       
  2246 </tr>
       
  2247 <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
       
  2248 set to <em>True</em>), or only DB object otherwise</p>
       
  2249 </td>
       
  2250 </tr>
       
  2251 </tbody>
       
  2252 </table>
       
  2253 </dd></dl>
       
  2254 
       
  2255 <dl class="method">
       
  2256 <dt id="pyams_utils.zodb.ZEOConnection.get_settings">
       
  2257 <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>
       
  2258 <dd><p>Get mapping of all connection settings</p>
       
  2259 <p>These settings can be converted to JSON and sent to another process, for example
       
  2260 via a ØMQ connection.</p>
       
  2261 <table class="docutils field-list" frame="void" rules="none">
       
  2262 <col class="field-name" />
       
  2263 <col class="field-body" />
       
  2264 <tbody valign="top">
       
  2265 <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">dict</td>
       
  2266 </tr>
       
  2267 </tbody>
       
  2268 </table>
       
  2269 </dd></dl>
       
  2270 
       
  2271 <dl class="attribute">
       
  2272 <dt id="pyams_utils.zodb.ZEOConnection.name">
       
  2273 <code class="descname">name</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.name" title="Permalink to this definition">¶</a></dt>
       
  2274 <dd><p>Connection name: Registration name of ZEO connection</p>
       
  2275 </dd></dl>
       
  2276 
       
  2277 <dl class="attribute">
       
  2278 <dt id="pyams_utils.zodb.ZEOConnection.password">
       
  2279 <code class="descname">password</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.password" title="Permalink to this definition">¶</a></dt>
       
  2280 <dd><p>ZEO password: User password on ZEO server</p>
       
  2281 </dd></dl>
       
  2282 
       
  2283 <dl class="attribute">
       
  2284 <dt id="pyams_utils.zodb.ZEOConnection.server_name">
       
  2285 <code class="descname">server_name</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.server_name" title="Permalink to this definition">¶</a></dt>
       
  2286 <dd><p>ZEO server name: Hostname of ZEO server</p>
       
  2287 </dd></dl>
       
  2288 
       
  2289 <dl class="attribute">
       
  2290 <dt id="pyams_utils.zodb.ZEOConnection.server_port">
       
  2291 <code class="descname">server_port</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.server_port" title="Permalink to this definition">¶</a></dt>
       
  2292 <dd><p>ZEO server port: Port number of ZEO server</p>
       
  2293 </dd></dl>
       
  2294 
       
  2295 <dl class="attribute">
       
  2296 <dt id="pyams_utils.zodb.ZEOConnection.server_realm">
       
  2297 <code class="descname">server_realm</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.server_realm" title="Permalink to this definition">¶</a></dt>
       
  2298 <dd><p>ZEO server realm: Realm name on ZEO server</p>
       
  2299 </dd></dl>
       
  2300 
       
  2301 <dl class="attribute">
       
  2302 <dt id="pyams_utils.zodb.ZEOConnection.shared_blob_dir">
       
  2303 <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>
       
  2304 <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>
       
  2305 </dd></dl>
       
  2306 
       
  2307 <dl class="attribute">
       
  2308 <dt id="pyams_utils.zodb.ZEOConnection.storage">
       
  2309 <code class="descname">storage</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.storage" title="Permalink to this definition">¶</a></dt>
       
  2310 <dd><p>ZEO server storage: Storage name on ZEO server</p>
       
  2311 </dd></dl>
       
  2312 
       
  2313 <dl class="method">
       
  2314 <dt id="pyams_utils.zodb.ZEOConnection.update">
       
  2315 <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>
       
  2316 <dd><p>Update connection properties with settings as <em>dict</em></p>
       
  2317 <table class="docutils field-list" frame="void" rules="none">
       
  2318 <col class="field-name" />
       
  2319 <col class="field-body" />
       
  2320 <tbody valign="top">
       
  2321 <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
       
  2322 another process</td>
       
  2323 </tr>
       
  2324 </tbody>
       
  2325 </table>
       
  2326 </dd></dl>
       
  2327 
       
  2328 <dl class="attribute">
       
  2329 <dt id="pyams_utils.zodb.ZEOConnection.username">
       
  2330 <code class="descname">username</code><a class="headerlink" href="#pyams_utils.zodb.ZEOConnection.username" title="Permalink to this definition">¶</a></dt>
       
  2331 <dd><p>ZEO user name: User name on ZEO server</p>
       
  2332 </dd></dl>
       
  2333 
       
  2334 </dd></dl>
       
  2335 
       
  2336 <dl class="class">
       
  2337 <dt id="pyams_utils.zodb.ZEOConnectionUtility">
       
  2338 <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>
       
  2339 <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>
       
  2340 <p>Persistent ZEO connection utility</p>
       
  2341 </dd></dl>
       
  2342 
       
  2343 <dl class="class">
       
  2344 <dt id="pyams_utils.zodb.ZEOConnectionVocabulary">
       
  2345 <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>
       
  2346 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.vocabulary.SimpleVocabulary</span></code></p>
       
  2347 <p>ZEO connections vocabulary</p>
       
  2348 </dd></dl>
       
  2349 
       
  2350 <dl class="class">
       
  2351 <dt id="pyams_utils.zodb.ZODBConnection">
       
  2352 <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>
       
  2353 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
       
  2354 <p>ZODB connection wrapper</p>
       
  2355 <p>Connections are extracted from Pyramid’s settings file in <em>zodbconn.uri</em> entries.</p>
       
  2356 <p>Note that a ZODB connection object is a context manager, so you can use it like this:</p>
       
  2357 <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>
       
  2358 
       
  2359 <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>
       
  2360     <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>
       
  2361     <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>
       
  2362         <span class="c1"># *root* is then the ZODB root object</span>
       
  2363         <span class="c1"># do whatever you want with ZODB connection,</span>
       
  2364         <span class="c1"># which is closed automatically</span>
       
  2365 </pre></div>
       
  2366 </div>
       
  2367 <dl class="method">
       
  2368 <dt id="pyams_utils.zodb.ZODBConnection.close">
       
  2369 <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>
       
  2370 <dd></dd></dl>
       
  2371 
       
  2372 <dl class="attribute">
       
  2373 <dt id="pyams_utils.zodb.ZODBConnection.connection">
       
  2374 <code class="descname">connection</code><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection.connection" title="Permalink to this definition">¶</a></dt>
       
  2375 <dd></dd></dl>
       
  2376 
       
  2377 <dl class="attribute">
       
  2378 <dt id="pyams_utils.zodb.ZODBConnection.db">
       
  2379 <code class="descname">db</code><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection.db" title="Permalink to this definition">¶</a></dt>
       
  2380 <dd></dd></dl>
       
  2381 
       
  2382 <dl class="method">
       
  2383 <dt id="pyams_utils.zodb.ZODBConnection.get_connection">
       
  2384 <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>
       
  2385 <dd><p>Load named connection matching registry settings</p>
       
  2386 </dd></dl>
       
  2387 
       
  2388 <dl class="attribute">
       
  2389 <dt id="pyams_utils.zodb.ZODBConnection.storage">
       
  2390 <code class="descname">storage</code><a class="headerlink" href="#pyams_utils.zodb.ZODBConnection.storage" title="Permalink to this definition">¶</a></dt>
       
  2391 <dd></dd></dl>
       
  2392 
       
  2393 </dd></dl>
       
  2394 
       
  2395 <dl class="class">
       
  2396 <dt id="pyams_utils.zodb.ZODBConnectionVocabulary">
       
  2397 <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>
       
  2398 <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">zope.schema.vocabulary.SimpleVocabulary</span></code></p>
       
  2399 <p>ZODB connections vocabulary</p>
       
  2400 </dd></dl>
       
  2401 
       
  2402 <dl class="function">
       
  2403 <dt id="pyams_utils.zodb.get_connection_from_settings">
       
  2404 <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>
       
  2405 <dd><p>Load connection matching registry settings</p>
       
  2406 </dd></dl>
       
  2407 
       
  2408 <dl class="function">
       
  2409 <dt id="pyams_utils.zodb.handle_added_connection">
       
  2410 <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>
       
  2411 <dd><p>Register new ZEO connection when added</p>
       
  2412 </dd></dl>
       
  2413 
       
  2414 <dl class="function">
       
  2415 <dt id="pyams_utils.zodb.handle_removed_connection">
       
  2416 <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>
       
  2417 <dd><p>Un-register ZEO connection when deleted</p>
       
  2418 </dd></dl>
       
  2419 
       
  2420 <dl class="function">
       
  2421 <dt id="pyams_utils.zodb.object_key_adapter">
       
  2422 <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>
       
  2423 <dd></dd></dl>
       
  2424 
       
  2425 <dl class="function">
       
  2426 <dt id="pyams_utils.zodb.persistent_connection">
       
  2427 <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>
       
  2428 <dd><p>An adapter which gets a ZODB connection from a persistent object</p>
       
  2429 <p>We are assuming the object has a parent if it has been created in
       
  2430 this transaction.</p>
       
  2431 <p>Raises ValueError if it is impossible to get a connection.</p>
       
  2432 </dd></dl>
       
  2433 
       
  2434 <dl class="function">
       
  2435 <dt id="pyams_utils.zodb.persistent_transaction_manager">
       
  2436 <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>
       
  2437 <dd></dd></dl>
       
  2438 
       
  2439 </div>
       
  2440 </div>
       
  2441 </div>
       
  2442 
       
  2443 
       
  2444           </div>
       
  2445         </div>
       
  2446       </div>
       
  2447       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
       
  2448         <div class="sphinxsidebarwrapper">
       
  2449   <h3><a href="index.html">Table Of Contents</a></h3>
       
  2450   <ul>
       
  2451 <li><a class="reference internal" href="#">PyAMS utilities</a><ul>
       
  2452 <li><a class="reference internal" href="#subpackages">Subpackages</a></li>
       
  2453 <li><a class="reference internal" href="#module-pyams_utils">Module contents</a></li>
       
  2454 <li><a class="reference internal" href="#submodules">Submodules</a><ul>
       
  2455 <li><a class="reference internal" href="#module-pyams_utils.adapter">pyams_utils.adapter module</a></li>
       
  2456 <li><a class="reference internal" href="#module-pyams_utils.attr">pyams_utils.attr module</a></li>
       
  2457 <li><a class="reference internal" href="#module-pyams_utils.container">pyams_utils.container module</a></li>
       
  2458 <li><a class="reference internal" href="#module-pyams_utils.context">pyams_utils.context module</a></li>
       
  2459 <li><a class="reference internal" href="#module-pyams_utils.data">pyams_utils.data module</a></li>
       
  2460 <li><a class="reference internal" href="#module-pyams_utils.date">pyams_utils.date module</a></li>
       
  2461 <li><a class="reference internal" href="#module-pyams_utils.decorator">pyams_utils.decorator module</a></li>
       
  2462 <li><a class="reference internal" href="#module-pyams_utils.dict">pyams_utils.dict module</a></li>
       
  2463 <li><a class="reference internal" href="#module-pyams_utils.encoding">pyams_utils.encoding module</a></li>
       
  2464 <li><a class="reference internal" href="#module-pyams_utils.fanstatic">pyams_utils.fanstatic module</a></li>
       
  2465 <li><a class="reference internal" href="#module-pyams_utils.html">pyams_utils.html module</a></li>
       
  2466 <li><a class="reference internal" href="#module-pyams_utils.i18n">pyams_utils.i18n module</a></li>
       
  2467 <li><a class="reference internal" href="#module-pyams_utils.include">pyams_utils.include module</a></li>
       
  2468 <li><a class="reference internal" href="#module-pyams_utils.intids">pyams_utils.intids module</a></li>
       
  2469 <li><a class="reference internal" href="#module-pyams_utils.list">pyams_utils.list module</a></li>
       
  2470 <li><a class="reference internal" href="#module-pyams_utils.lock">pyams_utils.lock module</a></li>
       
  2471 <li><a class="reference internal" href="#module-pyams_utils.progress">pyams_utils.progress module</a></li>
       
  2472 <li><a class="reference internal" href="#module-pyams_utils.property">pyams_utils.property module</a></li>
       
  2473 <li><a class="reference internal" href="#module-pyams_utils.registry">pyams_utils.registry module</a></li>
       
  2474 <li><a class="reference internal" href="#module-pyams_utils.request">pyams_utils.request module</a></li>
       
  2475 <li><a class="reference internal" href="#module-pyams_utils.schema">pyams_utils.schema module</a></li>
       
  2476 <li><a class="reference internal" href="#module-pyams_utils.session">pyams_utils.session module</a></li>
       
  2477 <li><a class="reference internal" href="#module-pyams_utils.site">pyams_utils.site module</a></li>
       
  2478 <li><a class="reference internal" href="#module-pyams_utils.size">pyams_utils.size module</a></li>
       
  2479 <li><a class="reference internal" href="#module-pyams_utils.tales">pyams_utils.tales module</a></li>
       
  2480 <li><a class="reference internal" href="#module-pyams_utils.text">pyams_utils.text module</a></li>
       
  2481 <li><a class="reference internal" href="#module-pyams_utils.traversing">pyams_utils.traversing module</a></li>
       
  2482 <li><a class="reference internal" href="#module-pyams_utils.unicode">pyams_utils.unicode module</a></li>
       
  2483 <li><a class="reference internal" href="#module-pyams_utils.url">pyams_utils.url module</a></li>
       
  2484 <li><a class="reference internal" href="#module-pyams_utils.vocabulary">pyams_utils.vocabulary module</a></li>
       
  2485 <li><a class="reference internal" href="#module-pyams_utils.wsgi">pyams_utils.wsgi module</a></li>
       
  2486 <li><a class="reference internal" href="#module-pyams_utils.zodb">pyams_utils.zodb module</a></li>
       
  2487 </ul>
       
  2488 </li>
       
  2489 </ul>
       
  2490 </li>
       
  2491 </ul>
       
  2492 
       
  2493 <div id="searchbox" style="display: none" role="search">
       
  2494   <h3>Quick search</h3>
       
  2495     <form class="search" action="search.html" method="get">
       
  2496       <div><input type="text" name="q" /></div>
       
  2497       <div><input type="submit" value="Go" /></div>
       
  2498       <input type="hidden" name="check_keywords" value="yes" />
       
  2499       <input type="hidden" name="area" value="default" />
       
  2500     </form>
       
  2501 </div>
       
  2502 <script type="text/javascript">$('#searchbox').show(0);</script>
       
  2503         </div>
       
  2504       </div>
       
  2505       <div class="clearer"></div>
       
  2506     </div>
       
  2507     <div class="related" role="navigation" aria-label="related navigation">
       
  2508       <h3>Navigation</h3>
       
  2509       <ul>
       
  2510         <li class="right" style="margin-right: 10px">
       
  2511           <a href="genindex.html" title="General Index"
       
  2512              >index</a></li>
       
  2513         <li class="right" >
       
  2514           <a href="py-modindex.html" title="Python Module Index"
       
  2515              >modules</a> |</li>
       
  2516         <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> &#187;</li> 
       
  2517       </ul>
       
  2518     </div>
       
  2519     <div class="footer" role="contentinfo">
       
  2520         &#169; Copyright 2017, Thierry Florac.
       
  2521       Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5.
       
  2522     </div>
       
  2523   </body>
       
  2524 </html>