Sophie

Sophie

distrib > Mageia > 4 > i586 > media > core-release > by-pkgid > c95717a2237548a7bdaddf39c85b0f0f > files > 146

python-sphinx-doc-1.1.3-7.mga4.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="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Storage Backends &mdash; Sphinx 1.1.3 documentation</title>
    
    <link rel="stylesheet" href="../_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.1.3',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Sphinx 1.1.3 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="top" title="Sphinx 1.1.3 documentation" href="../index.html" />
    <link rel="up" title="Sphinx Web Support" href="../websupport.html" />
    <link rel="next" title="Sphinx FAQ" href="../faq.html" />
    <link rel="prev" title="Search Adapters" href="searchadapters.html" />
 
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head>
  <body>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<img src="../_static/sphinx.png" alt="Sphinx logo" />
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../faq.html" title="Sphinx FAQ"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="searchadapters.html" title="Search Adapters"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Sphinx home</a>&nbsp;|&nbsp;</li>
        <li><a href="../contents.html">Documentation</a>
          &raquo;</li>

          <li><a href="../websupport.html" accesskey="U">Sphinx Web Support</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Storage Backends</a><ul>
<li><a class="reference internal" href="#storagebackend-methods">StorageBackend Methods</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="searchadapters.html"
                        title="previous chapter">Search Adapters</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../faq.html"
                        title="next chapter">Sphinx FAQ</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/web/storagebackends.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <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>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="storage-backends">
<span id="storagebackends"></span><h1>Storage Backends<a class="headerlink" href="#storage-backends" title="Permalink to this headline">¶</a></h1>
<p>To create a custom storage backend you will need to subclass the
<a class="reference internal" href="#sphinx.websupport.storage.StorageBackend" title="sphinx.websupport.storage.StorageBackend"><tt class="xref py py-class docutils literal"><span class="pre">StorageBackend</span></tt></a> class.  Then create an instance of the new class and
pass that as the <cite>storage</cite> keyword argument when you create the
<a class="reference internal" href="api.html#sphinx.websupport.WebSupport" title="sphinx.websupport.WebSupport"><tt class="xref py py-class docutils literal"><span class="pre">WebSupport</span></tt></a> object:</p>
<div class="highlight-python"><pre>support = WebSupport(srcdir=srcdir,
                     builddir=builddir,
                     storage=MyStorage())</pre>
</div>
<p>For more information about creating a custom storage backend, please see the
documentation of the <a class="reference internal" href="#sphinx.websupport.storage.StorageBackend" title="sphinx.websupport.storage.StorageBackend"><tt class="xref py py-class docutils literal"><span class="pre">StorageBackend</span></tt></a> class below.</p>
<dl class="class">
<dt id="sphinx.websupport.storage.StorageBackend">
<em class="property">class </em><tt class="descclassname">sphinx.websupport.storage.</tt><tt class="descname">StorageBackend</tt><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines an interface for storage backends.</p>
</dd></dl>

<div class="section" id="storagebackend-methods">
<h2>StorageBackend Methods<a class="headerlink" href="#storagebackend-methods" title="Permalink to this headline">¶</a></h2>
<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.pre_build">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">pre_build</tt><big>(</big><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.pre_build" title="Permalink to this definition">¶</a></dt>
<dd><p>Called immediately before the build process begins. Use this
to prepare the StorageBackend for the addition of nodes.</p>
</dd></dl>

<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.add_node">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">add_node</tt><big>(</big><em>id</em>, <em>document</em>, <em>source</em><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.add_node" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a node to the StorageBackend.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>id</strong> &#8211; a unique id for the comment.</li>
<li><strong>document</strong> &#8211; the name of the document the node belongs to.</li>
<li><strong>source</strong> &#8211; the source files name.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.post_build">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">post_build</tt><big>(</big><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.post_build" title="Permalink to this definition">¶</a></dt>
<dd><p>Called after a build has completed. Use this to finalize the
addition of nodes if needed.</p>
</dd></dl>

<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.add_comment">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">add_comment</tt><big>(</big><em>text</em>, <em>displayed</em>, <em>username</em>, <em>time</em>, <em>proposal</em>, <em>node_id</em>, <em>parent_id</em>, <em>moderator</em><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.add_comment" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when a comment is being added.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>text</strong> &#8211; the text of the comment</li>
<li><strong>displayed</strong> &#8211; whether the comment should be displayed</li>
<li><strong>username</strong> &#8211; the name of the user adding the comment</li>
<li><strong>time</strong> &#8211; a date object with the time the comment was added</li>
<li><strong>proposal</strong> &#8211; the text of the proposal the user made</li>
<li><strong>node_id</strong> &#8211; the id of the node that the comment is being added to</li>
<li><strong>parent_id</strong> &#8211; the id of the comment&#8217;s parent comment.</li>
<li><strong>moderator</strong> &#8211; whether the user adding the comment is a moderator</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.delete_comment">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">delete_comment</tt><big>(</big><em>comment_id</em>, <em>username</em>, <em>moderator</em><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.delete_comment" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete a comment.</p>
<p>Raises <tt class="xref py py-class docutils literal"><span class="pre">UserNotAuthorizedError</span></tt>
if moderator is False and <cite>username</cite> doesn&#8217;t match the username
on the comment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>comment_id</strong> &#8211; The id of the comment being deleted.</li>
<li><strong>username</strong> &#8211; The username of the user requesting the deletion.</li>
<li><strong>moderator</strong> &#8211; Whether the user is a moderator.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.get_data">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">get_data</tt><big>(</big><em>node_id</em>, <em>username</em>, <em>moderator</em><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.get_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Called to retrieve all data for a node. This should return a
dict with two keys, <em>source</em> and <em>comments</em> as described by
<a class="reference internal" href="api.html#sphinx.websupport.WebSupport" title="sphinx.websupport.WebSupport"><tt class="xref py py-class docutils literal"><span class="pre">WebSupport</span></tt></a>&#8216;s
<a class="reference internal" href="api.html#sphinx.websupport.WebSupport.get_data" title="sphinx.websupport.WebSupport.get_data"><tt class="xref py py-meth docutils literal"><span class="pre">get_data()</span></tt></a> method.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>node_id</strong> &#8211; The id of the node to get data for.</li>
<li><strong>username</strong> &#8211; The name of the user requesting the data.</li>
<li><strong>moderator</strong> &#8211; Whether the requestor is a moderator.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.process_vote">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">process_vote</tt><big>(</big><em>comment_id</em>, <em>username</em>, <em>value</em><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.process_vote" title="Permalink to this definition">¶</a></dt>
<dd><p>Process a vote that is being cast. <cite>value</cite> will be either -1, 0,
or 1.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>comment_id</strong> &#8211; The id of the comment being voted on.</li>
<li><strong>username</strong> &#8211; The username of the user casting the vote.</li>
<li><strong>value</strong> &#8211; The value of the vote being cast.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.update_username">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">update_username</tt><big>(</big><em>old_username</em>, <em>new_username</em><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.update_username" title="Permalink to this definition">¶</a></dt>
<dd><p>If a user is allowed to change their username this method should
be called so that there is not stagnate data in the storage system.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>old_username</strong> &#8211; The username being changed.</li>
<li><strong>new_username</strong> &#8211; What the username is being changed to.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="sphinx.websupport.storage.StorageBackend.accept_comment">
<tt class="descclassname">StorageBackend.</tt><tt class="descname">accept_comment</tt><big>(</big><em>comment_id</em><big>)</big><a class="headerlink" href="#sphinx.websupport.storage.StorageBackend.accept_comment" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when a moderator accepts a comment. After the method is
called the comment should be displayed to all users.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>comment_id</strong> &#8211; The id of the comment being accepted.</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../faq.html" title="Sphinx FAQ"
             >next</a> |</li>
        <li class="right" >
          <a href="searchadapters.html" title="Search Adapters"
             >previous</a> |</li>
        <li><a href="../index.html">Sphinx home</a>&nbsp;|&nbsp;</li>
        <li><a href="../contents.html">Documentation</a>
          &raquo;</li>

          <li><a href="../websupport.html" >Sphinx Web Support</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2007-2011, Georg Brandl.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>