Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 16b6c7fca2fc9f56193b382cc05af140 > files > 211

python3-zope-component-4.4.1-3.mga7.noarch.rpm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Layers &#8212; zope.component 4.4.1 documentation</title>
    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/language_data.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="zope.component API Reference" href="api.html" />
    <link rel="prev" title="The current component registry" href="hooks.html" />
   
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="layers">
<h1>Layers<a class="headerlink" href="#layers" title="Permalink to this headline">¶</a></h1>
<p>zope.component.testlayer defines two things:</p>
<ul class="simple">
<li>a LayerBase that makes it easier and saner to use zope.testing’s
test layers.</li>
<li>a ZCMLLayer which lets you implement a layer that loads up some
ZCML.</li>
</ul>
<div class="section" id="layerbase">
<h2>LayerBase<a class="headerlink" href="#layerbase" title="Permalink to this headline">¶</a></h2>
<p>We check whether our LayerBase can be used to create layers of our
own. We do this simply by subclassing:</p>
<p>Note that if we wanted to ensure that the methods of the superclass
were called we have to use super(). In this case we actually wouldn’t
need to, as these methods do nothing at all, but we just ensure that
they are there in the first place.</p>
<p>Let’s instantiate our layer. We need to supply it with the package the
layer is defined in:</p>
<p>Now we run some tests with this layer:</p>
</div>
<div class="section" id="zcmllayer">
<h2>ZCMLLayer<a class="headerlink" href="#zcmllayer" title="Permalink to this headline">¶</a></h2>
<p>We now want a layer that loads up some ZCML from a file. The default
is <code class="docutils literal notranslate"><span class="pre">ftesting.zcml</span></code>, but here we’ll load a test <code class="docutils literal notranslate"><span class="pre">testlayer.zcml</span></code>.
We can also choose to provide extra ZCML features that are used <a class="reference external" href="http://zopeconfiguration.readthedocs.io/en/latest/narr.html#making-specific-directives-conditional">to
conditionally control processing of certain directives</a>
(here we use “devmode”, a common condition for controlling development
options like debugging output).</p>
<p>Since the ZCML sets up an adapter, we expect the tests to pass:</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">zope.component</a></h1>








<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="narr.html">Zope Component Architecture</a></li>
<li class="toctree-l1"><a class="reference internal" href="socketexample.html">The Zope 3 Component Architecture (Socket Example)</a></li>
<li class="toctree-l1"><a class="reference internal" href="event.html">Events</a></li>
<li class="toctree-l1"><a class="reference internal" href="factory.html">Factories</a></li>
<li class="toctree-l1"><a class="reference internal" href="persistentregistry.html">Persistent Component Management</a></li>
<li class="toctree-l1"><a class="reference internal" href="zcml.html">ZCML directives</a></li>
<li class="toctree-l1"><a class="reference internal" href="configure.html">Package configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="hooks.html">The current component registry</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Layers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#layerbase">LayerBase</a></li>
<li class="toctree-l2"><a class="reference internal" href="#zcmllayer">ZCMLLayer</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="api.html"><code class="docutils literal notranslate"><span class="pre">zope.component</span></code> API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="hacking.html">Hacking on <code class="docutils literal notranslate"><span class="pre">zope.component</span></code></a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="hooks.html" title="previous chapter">The current component registry</a></li>
      <li>Next: <a href="api.html" title="next chapter"><code class="docutils literal notranslate"><span class="pre">zope.component</span></code> API Reference</a></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;Zope Foundation and Contributors.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.8.3</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
      
      |
      <a href="_sources/testlayer.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>