Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8f1462e52e1797a02c97073eed0b7f92 > files > 804

python-docs-2.6.5-2.5mdv2010.2.i586.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>19.5. mhlib — Access to MH mailboxes &mdash; Python v2.6.5 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.5',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.5 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.5 documentation" href="../index.html" />
    <link rel="up" title="19. Internet Data Handling" href="netdata.html" />
    <link rel="next" title="19.6. mimetools — Tools for parsing MIME messages" href="mimetools.html" />
    <link rel="prev" title="19.4. mailbox — Manipulate mailboxes in various formats" href="mailbox.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <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="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="mimetools.html" title="19.6. mimetools — Tools for parsing MIME messages"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mailbox.html" title="19.4. mailbox — Manipulate mailboxes in various formats"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.5 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="netdata.html" accesskey="U">19. Internet Data Handling</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-mhlib">
<h1>19.5. <tt class="xref docutils literal"><span class="pre">mhlib</span></tt> &#8212; Access to MH mailboxes<a class="headerlink" href="#module-mhlib" title="Permalink to this headline">¶</a></h1>
<p class="deprecated">
<span class="versionmodified">Deprecated since version 2.6: </span>The <tt class="xref docutils literal"><span class="pre">mhlib</span></tt> module has been removed in Python 3.0. Use the
<a title="Manipulate mailboxes in various formats" class="reference external" href="mailbox.html#module-mailbox"><tt class="xref docutils literal"><span class="pre">mailbox</span></tt></a> instead.</p>
<p>The <tt class="xref docutils literal"><span class="pre">mhlib</span></tt> module provides a Python interface to MH folders and their
contents.</p>
<p>The module contains three basic classes, <a title="mhlib.MH" class="reference internal" href="#mhlib.MH"><tt class="xref docutils literal"><span class="pre">MH</span></tt></a>, which represents a
particular collection of folders, <a title="mhlib.Folder" class="reference internal" href="#mhlib.Folder"><tt class="xref docutils literal"><span class="pre">Folder</span></tt></a>, which represents a single
folder, and <a title="mhlib.Message" class="reference internal" href="#mhlib.Message"><tt class="xref docutils literal"><span class="pre">Message</span></tt></a>, which represents a single message.</p>
<dl class="class">
<dt id="mhlib.MH">
<em class="property">class </em><tt class="descclassname">mhlib.</tt><tt class="descname">MH</tt><big>(</big><span class="optional">[</span><em>path</em><span class="optional">[</span>, <em>profile</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#mhlib.MH" title="Permalink to this definition">¶</a></dt>
<dd><a title="mhlib.MH" class="reference internal" href="#mhlib.MH"><tt class="xref docutils literal"><span class="pre">MH</span></tt></a> represents a collection of MH folders.</dd></dl>

<dl class="class">
<dt id="mhlib.Folder">
<em class="property">class </em><tt class="descclassname">mhlib.</tt><tt class="descname">Folder</tt><big>(</big><em>mh</em>, <em>name</em><big>)</big><a class="headerlink" href="#mhlib.Folder" title="Permalink to this definition">¶</a></dt>
<dd>The <a title="mhlib.Folder" class="reference internal" href="#mhlib.Folder"><tt class="xref docutils literal"><span class="pre">Folder</span></tt></a> class represents a single folder and its messages.</dd></dl>

<dl class="class">
<dt id="mhlib.Message">
<em class="property">class </em><tt class="descclassname">mhlib.</tt><tt class="descname">Message</tt><big>(</big><em>folder</em>, <em>number</em><span class="optional">[</span>, <em>name</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#mhlib.Message" title="Permalink to this definition">¶</a></dt>
<dd><a title="mhlib.Message" class="reference internal" href="#mhlib.Message"><tt class="xref docutils literal"><span class="pre">Message</span></tt></a> objects represent individual messages in a folder.  The Message
class is derived from <a title="mimetools.Message" class="reference external" href="mimetools.html#mimetools.Message"><tt class="xref docutils literal"><span class="pre">mimetools.Message</span></tt></a>.</dd></dl>

<div class="section" id="mh-objects">
<span id="id1"></span><h2>19.5.1. MH Objects<a class="headerlink" href="#mh-objects" title="Permalink to this headline">¶</a></h2>
<p><a title="mhlib.MH" class="reference internal" href="#mhlib.MH"><tt class="xref docutils literal"><span class="pre">MH</span></tt></a> instances have the following methods:</p>
<dl class="method">
<dt id="mhlib.MH.error">
<tt class="descclassname">MH.</tt><tt class="descname">error</tt><big>(</big><em>format</em><span class="optional">[</span>, <em>...</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#mhlib.MH.error" title="Permalink to this definition">¶</a></dt>
<dd>Print an error message &#8211; can be overridden.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.getprofile">
<tt class="descclassname">MH.</tt><tt class="descname">getprofile</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#mhlib.MH.getprofile" title="Permalink to this definition">¶</a></dt>
<dd>Return a profile entry (<tt class="xref docutils literal"><span class="pre">None</span></tt> if not set).</dd></dl>

<dl class="method">
<dt id="mhlib.MH.getpath">
<tt class="descclassname">MH.</tt><tt class="descname">getpath</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.MH.getpath" title="Permalink to this definition">¶</a></dt>
<dd>Return the mailbox pathname.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.getcontext">
<tt class="descclassname">MH.</tt><tt class="descname">getcontext</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.MH.getcontext" title="Permalink to this definition">¶</a></dt>
<dd>Return the current folder name.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.setcontext">
<tt class="descclassname">MH.</tt><tt class="descname">setcontext</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#mhlib.MH.setcontext" title="Permalink to this definition">¶</a></dt>
<dd>Set the current folder name.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.listfolders">
<tt class="descclassname">MH.</tt><tt class="descname">listfolders</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.MH.listfolders" title="Permalink to this definition">¶</a></dt>
<dd>Return a list of top-level folders.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.listallfolders">
<tt class="descclassname">MH.</tt><tt class="descname">listallfolders</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.MH.listallfolders" title="Permalink to this definition">¶</a></dt>
<dd>Return a list of all folders.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.listsubfolders">
<tt class="descclassname">MH.</tt><tt class="descname">listsubfolders</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#mhlib.MH.listsubfolders" title="Permalink to this definition">¶</a></dt>
<dd>Return a list of direct subfolders of the given folder.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.listallsubfolders">
<tt class="descclassname">MH.</tt><tt class="descname">listallsubfolders</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#mhlib.MH.listallsubfolders" title="Permalink to this definition">¶</a></dt>
<dd>Return a list of all subfolders of the given folder.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.makefolder">
<tt class="descclassname">MH.</tt><tt class="descname">makefolder</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#mhlib.MH.makefolder" title="Permalink to this definition">¶</a></dt>
<dd>Create a new folder.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.deletefolder">
<tt class="descclassname">MH.</tt><tt class="descname">deletefolder</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#mhlib.MH.deletefolder" title="Permalink to this definition">¶</a></dt>
<dd>Delete a folder &#8211; must have no subfolders.</dd></dl>

<dl class="method">
<dt id="mhlib.MH.openfolder">
<tt class="descclassname">MH.</tt><tt class="descname">openfolder</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#mhlib.MH.openfolder" title="Permalink to this definition">¶</a></dt>
<dd>Return a new open folder object.</dd></dl>

</div>
<div class="section" id="folder-objects">
<span id="mh-folder-objects"></span><h2>19.5.2. Folder Objects<a class="headerlink" href="#folder-objects" title="Permalink to this headline">¶</a></h2>
<p><a title="mhlib.Folder" class="reference internal" href="#mhlib.Folder"><tt class="xref docutils literal"><span class="pre">Folder</span></tt></a> instances represent open folders and have the following methods:</p>
<dl class="method">
<dt id="mhlib.Folder.error">
<tt class="descclassname">Folder.</tt><tt class="descname">error</tt><big>(</big><em>format</em><span class="optional">[</span>, <em>...</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#mhlib.Folder.error" title="Permalink to this definition">¶</a></dt>
<dd>Print an error message &#8211; can be overridden.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.getfullname">
<tt class="descclassname">Folder.</tt><tt class="descname">getfullname</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.Folder.getfullname" title="Permalink to this definition">¶</a></dt>
<dd>Return the folder&#8217;s full pathname.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.getsequencesfilename">
<tt class="descclassname">Folder.</tt><tt class="descname">getsequencesfilename</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.Folder.getsequencesfilename" title="Permalink to this definition">¶</a></dt>
<dd>Return the full pathname of the folder&#8217;s sequences file.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.getmessagefilename">
<tt class="descclassname">Folder.</tt><tt class="descname">getmessagefilename</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#mhlib.Folder.getmessagefilename" title="Permalink to this definition">¶</a></dt>
<dd>Return the full pathname of message <em>n</em> of the folder.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.listmessages">
<tt class="descclassname">Folder.</tt><tt class="descname">listmessages</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.Folder.listmessages" title="Permalink to this definition">¶</a></dt>
<dd>Return a list of messages in the folder (as numbers).</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.getcurrent">
<tt class="descclassname">Folder.</tt><tt class="descname">getcurrent</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.Folder.getcurrent" title="Permalink to this definition">¶</a></dt>
<dd>Return the current message number.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.setcurrent">
<tt class="descclassname">Folder.</tt><tt class="descname">setcurrent</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#mhlib.Folder.setcurrent" title="Permalink to this definition">¶</a></dt>
<dd>Set the current message number to <em>n</em>.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.parsesequence">
<tt class="descclassname">Folder.</tt><tt class="descname">parsesequence</tt><big>(</big><em>seq</em><big>)</big><a class="headerlink" href="#mhlib.Folder.parsesequence" title="Permalink to this definition">¶</a></dt>
<dd>Parse msgs syntax into list of messages.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.getlast">
<tt class="descclassname">Folder.</tt><tt class="descname">getlast</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.Folder.getlast" title="Permalink to this definition">¶</a></dt>
<dd>Get last message, or <tt class="docutils literal"><span class="pre">0</span></tt> if no messages are in the folder.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.setlast">
<tt class="descclassname">Folder.</tt><tt class="descname">setlast</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#mhlib.Folder.setlast" title="Permalink to this definition">¶</a></dt>
<dd>Set last message (internal use only).</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.getsequences">
<tt class="descclassname">Folder.</tt><tt class="descname">getsequences</tt><big>(</big><big>)</big><a class="headerlink" href="#mhlib.Folder.getsequences" title="Permalink to this definition">¶</a></dt>
<dd>Return dictionary of sequences in folder.  The sequence names are used  as keys,
and the values are the lists of message numbers in the sequences.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.putsequences">
<tt class="descclassname">Folder.</tt><tt class="descname">putsequences</tt><big>(</big><em>dict</em><big>)</big><a class="headerlink" href="#mhlib.Folder.putsequences" title="Permalink to this definition">¶</a></dt>
<dd>Return dictionary of sequences in folder name: list.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.removemessages">
<tt class="descclassname">Folder.</tt><tt class="descname">removemessages</tt><big>(</big><em>list</em><big>)</big><a class="headerlink" href="#mhlib.Folder.removemessages" title="Permalink to this definition">¶</a></dt>
<dd>Remove messages in list from folder.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.refilemessages">
<tt class="descclassname">Folder.</tt><tt class="descname">refilemessages</tt><big>(</big><em>list</em>, <em>tofolder</em><big>)</big><a class="headerlink" href="#mhlib.Folder.refilemessages" title="Permalink to this definition">¶</a></dt>
<dd>Move messages in list to other folder.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.movemessage">
<tt class="descclassname">Folder.</tt><tt class="descname">movemessage</tt><big>(</big><em>n</em>, <em>tofolder</em>, <em>ton</em><big>)</big><a class="headerlink" href="#mhlib.Folder.movemessage" title="Permalink to this definition">¶</a></dt>
<dd>Move one message to a given destination in another folder.</dd></dl>

<dl class="method">
<dt id="mhlib.Folder.copymessage">
<tt class="descclassname">Folder.</tt><tt class="descname">copymessage</tt><big>(</big><em>n</em>, <em>tofolder</em>, <em>ton</em><big>)</big><a class="headerlink" href="#mhlib.Folder.copymessage" title="Permalink to this definition">¶</a></dt>
<dd>Copy one message to a given destination in another folder.</dd></dl>

</div>
<div class="section" id="message-objects">
<span id="mh-message-objects"></span><h2>19.5.3. Message Objects<a class="headerlink" href="#message-objects" title="Permalink to this headline">¶</a></h2>
<p>The <a title="mhlib.Message" class="reference internal" href="#mhlib.Message"><tt class="xref docutils literal"><span class="pre">Message</span></tt></a> class adds one method to those of
<a title="mimetools.Message" class="reference external" href="mimetools.html#mimetools.Message"><tt class="xref docutils literal"><span class="pre">mimetools.Message</span></tt></a>:</p>
<dl class="method">
<dt id="mhlib.Message.openmessage">
<tt class="descclassname">Message.</tt><tt class="descname">openmessage</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#mhlib.Message.openmessage" title="Permalink to this definition">¶</a></dt>
<dd>Return a new open message object (costs a file descriptor).</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../contents.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#">19.5. <tt class="docutils literal"><span class="pre">mhlib</span></tt> &#8212; Access to MH mailboxes</a><ul>
<li><a class="reference external" href="#mh-objects">19.5.1. MH Objects</a></li>
<li><a class="reference external" href="#folder-objects">19.5.2. Folder Objects</a></li>
<li><a class="reference external" href="#message-objects">19.5.3. Message Objects</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="mailbox.html"
                                  title="previous chapter">19.4. <tt class="docutils literal docutils literal docutils literal"><span class="pre">mailbox</span></tt> &#8212; Manipulate mailboxes in various formats</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="mimetools.html"
                                  title="next chapter">19.6. <tt class="docutils literal"><span class="pre">mimetools</span></tt> &#8212; Tools for parsing MIME messages</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/library/mhlib.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" size="18" />
                <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="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="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="mimetools.html" title="19.6. mimetools — Tools for parsing MIME messages"
             >next</a> |</li>
        <li class="right" >
          <a href="mailbox.html" title="19.4. mailbox — Manipulate mailboxes in various formats"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.5 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="netdata.html" >19. Internet Data Handling</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2010, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.  
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Mar 19, 2010.
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.5.
    </div>

  </body>
</html>