korsygfhrtzangaiide
Elepffwdsff
/
usr
/
share
/
doc
/
python-docs-2.7.5
/
html
/
library
/
Upload FileeE
HOME
<!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>36.1. ic — Access to the Mac OS X Internet Config — Python 2.7.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.7.5', 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> <script type="text/javascript" src="../_static/sidebar.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Python 2.7.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 2.7.5 documentation" href="../index.html" /> <link rel="up" title="36. Mac OS X specific services" href="mac.html" /> <link rel="next" title="36.2. MacOS — Access to Mac OS interpreter features" href="macos.html" /> <link rel="prev" title="36. Mac OS X specific services" href="mac.html" /> <link rel="shortcut icon" type="image/png" href="../_static/py.png" /> <script type="text/javascript" src="../_static/copybutton.js"></script> </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="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="macos.html" title="36.2. MacOS — Access to Mac OS interpreter features" accesskey="N">next</a> |</li> <li class="right" > <a href="mac.html" title="36. Mac OS X specific services" accesskey="P">previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> <li><a href="mac.html" accesskey="U">36. Mac OS X specific services</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-ic"> <span id="ic-access-to-the-mac-os-x-internet-config"></span><h1>36.1. <a class="reference internal" href="#module-ic" title="ic: Access to the Mac OS X Internet Config. (deprecated) (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">ic</span></tt></a> — Access to the Mac OS X Internet Config<a class="headerlink" href="#module-ic" title="Permalink to this headline">¶</a></h1> <p>This module provides access to various internet-related preferences set through <strong class="program">System Preferences</strong> or the <strong class="program">Finder</strong>.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">This module has been removed in Python 3.x.</p> </div> <p id="index-0">There is a low-level companion module <tt class="xref py py-mod docutils literal"><span class="pre">icglue</span></tt> which provides the basic Internet Config access functionality. This low-level module is not documented, but the docstrings of the routines document the parameters and the routine names are the same as for the Pascal or C API to Internet Config, so the standard IC programmers’ documentation can be used if this module is needed.</p> <p>The <a class="reference internal" href="#module-ic" title="ic: Access to the Mac OS X Internet Config. (deprecated) (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">ic</span></tt></a> module defines the <a class="reference internal" href="#ic.error" title="ic.error"><tt class="xref py py-exc docutils literal"><span class="pre">error</span></tt></a> exception and symbolic names for all error codes Internet Config can produce; see the source for details.</p> <dl class="exception"> <dt id="ic.error"> <em class="property">exception </em><tt class="descclassname">ic.</tt><tt class="descname">error</tt><a class="headerlink" href="#ic.error" title="Permalink to this definition">¶</a></dt> <dd><p>Exception raised on errors in the <a class="reference internal" href="#module-ic" title="ic: Access to the Mac OS X Internet Config. (deprecated) (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">ic</span></tt></a> module.</p> </dd></dl> <p>The <a class="reference internal" href="#module-ic" title="ic: Access to the Mac OS X Internet Config. (deprecated) (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">ic</span></tt></a> module defines the following class and function:</p> <dl class="class"> <dt id="ic.IC"> <em class="property">class </em><tt class="descclassname">ic.</tt><tt class="descname">IC</tt><big>(</big><span class="optional">[</span><em>signature</em><span class="optional">[</span>, <em>ic</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.IC" title="Permalink to this definition">¶</a></dt> <dd><p>Create an Internet Config object. The signature is a 4-character creator code of the current application (default <tt class="docutils literal"><span class="pre">'Pyth'</span></tt>) which may influence some of ICs settings. The optional <em>ic</em> argument is a low-level <tt class="docutils literal"><span class="pre">icglue.icinstance</span></tt> created beforehand, this may be useful if you want to get preferences from a different config file, etc.</p> </dd></dl> <dl class="function"> <dt id="ic.launchurl"> <tt class="descclassname">ic.</tt><tt class="descname">launchurl</tt><big>(</big><em>url</em><span class="optional">[</span>, <em>hint</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.launchurl" title="Permalink to this definition">¶</a></dt> <dt id="ic.parseurl"> <tt class="descclassname">ic.</tt><tt class="descname">parseurl</tt><big>(</big><em>data</em><span class="optional">[</span>, <em>start</em><span class="optional">[</span>, <em>end</em><span class="optional">[</span>, <em>hint</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.parseurl" title="Permalink to this definition">¶</a></dt> <dt id="ic.mapfile"> <tt class="descclassname">ic.</tt><tt class="descname">mapfile</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#ic.mapfile" title="Permalink to this definition">¶</a></dt> <dt id="ic.maptypecreator"> <tt class="descclassname">ic.</tt><tt class="descname">maptypecreator</tt><big>(</big><em>type</em>, <em>creator</em><span class="optional">[</span>, <em>filename</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.maptypecreator" title="Permalink to this definition">¶</a></dt> <dt id="ic.settypecreator"> <tt class="descclassname">ic.</tt><tt class="descname">settypecreator</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#ic.settypecreator" title="Permalink to this definition">¶</a></dt> <dd><p>These functions are “shortcuts” to the methods of the same name, described below.</p> </dd></dl> <div class="section" id="ic-objects"> <h2>36.1.1. IC Objects<a class="headerlink" href="#ic-objects" title="Permalink to this headline">¶</a></h2> <p><a class="reference internal" href="#ic.IC" title="ic.IC"><tt class="xref py py-class docutils literal"><span class="pre">IC</span></tt></a> objects have a mapping interface, hence to obtain the mail address you simply get <tt class="docutils literal"><span class="pre">ic['MailAddress']</span></tt>. Assignment also works, and changes the option in the configuration file.</p> <p>The module knows about various datatypes, and converts the internal IC representation to a “logical” Python data structure. Running the <a class="reference internal" href="#module-ic" title="ic: Access to the Mac OS X Internet Config. (deprecated) (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">ic</span></tt></a> module standalone will run a test program that lists all keys and values in your IC database, this will have to serve as documentation.</p> <p>If the module does not know how to represent the data it returns an instance of the <tt class="docutils literal"><span class="pre">ICOpaqueData</span></tt> type, with the raw data in its <tt class="xref py py-attr docutils literal"><span class="pre">data</span></tt> attribute. Objects of this type are also acceptable values for assignment.</p> <p>Besides the dictionary interface, <a class="reference internal" href="#ic.IC" title="ic.IC"><tt class="xref py py-class docutils literal"><span class="pre">IC</span></tt></a> objects have the following methods:</p> <dl class="method"> <dt id="ic.IC.launchurl"> <tt class="descclassname">IC.</tt><tt class="descname">launchurl</tt><big>(</big><em>url</em><span class="optional">[</span>, <em>hint</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.IC.launchurl" title="Permalink to this definition">¶</a></dt> <dd><p>Parse the given URL, launch the correct application and pass it the URL. The optional <em>hint</em> can be a scheme name such as <tt class="docutils literal"><span class="pre">'mailto:'</span></tt>, in which case incomplete URLs are completed with this scheme. If <em>hint</em> is not provided, incomplete URLs are invalid.</p> </dd></dl> <dl class="method"> <dt id="ic.IC.parseurl"> <tt class="descclassname">IC.</tt><tt class="descname">parseurl</tt><big>(</big><em>data</em><span class="optional">[</span>, <em>start</em><span class="optional">[</span>, <em>end</em><span class="optional">[</span>, <em>hint</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.IC.parseurl" title="Permalink to this definition">¶</a></dt> <dd><p>Find an URL somewhere in <em>data</em> and return start position, end position and the URL. The optional <em>start</em> and <em>end</em> can be used to limit the search, so for instance if a user clicks in a long text field you can pass the whole text field and the click-position in <em>start</em> and this routine will return the whole URL in which the user clicked. As above, <em>hint</em> is an optional scheme used to complete incomplete URLs.</p> </dd></dl> <dl class="method"> <dt id="ic.IC.mapfile"> <tt class="descclassname">IC.</tt><tt class="descname">mapfile</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#ic.IC.mapfile" title="Permalink to this definition">¶</a></dt> <dd><p>Return the mapping entry for the given <em>file</em>, which can be passed as either a filename or an <tt class="xref py py-func docutils literal"><span class="pre">FSSpec()</span></tt> result, and which need not exist.</p> <p>The mapping entry is returned as a tuple <tt class="docutils literal"><span class="pre">(version,</span> <span class="pre">type,</span> <span class="pre">creator,</span> <span class="pre">postcreator,</span> <span class="pre">flags,</span> <span class="pre">extension,</span> <span class="pre">appname,</span> <span class="pre">postappname,</span> <span class="pre">mimetype,</span> <span class="pre">entryname)</span></tt>, where <em>version</em> is the entry version number, <em>type</em> is the 4-character filetype, <em>creator</em> is the 4-character creator type, <em>postcreator</em> is the 4-character creator code of an optional application to post-process the file after downloading, <em>flags</em> are various bits specifying whether to transfer in binary or ascii and such, <em>extension</em> is the filename extension for this file type, <em>appname</em> is the printable name of the application to which this file belongs, <em>postappname</em> is the name of the postprocessing application, <em>mimetype</em> is the MIME type of this file and <em>entryname</em> is the name of this entry.</p> </dd></dl> <dl class="method"> <dt id="ic.IC.maptypecreator"> <tt class="descclassname">IC.</tt><tt class="descname">maptypecreator</tt><big>(</big><em>type</em>, <em>creator</em><span class="optional">[</span>, <em>filename</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#ic.IC.maptypecreator" title="Permalink to this definition">¶</a></dt> <dd><p>Return the mapping entry for files with given 4-character <em>type</em> and <em>creator</em> codes. The optional <em>filename</em> may be specified to further help finding the correct entry (if the creator code is <tt class="docutils literal"><span class="pre">'????'</span></tt>, for instance).</p> <p>The mapping entry is returned in the same format as for <em>mapfile</em>.</p> </dd></dl> <dl class="method"> <dt id="ic.IC.settypecreator"> <tt class="descclassname">IC.</tt><tt class="descname">settypecreator</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#ic.IC.settypecreator" title="Permalink to this definition">¶</a></dt> <dd><p>Given an existing <em>file</em>, specified either as a filename or as an <tt class="xref py py-func docutils literal"><span class="pre">FSSpec()</span></tt> result, set its creator and type correctly based on its extension. The finder is told about the change, so the finder icon will be updated quickly.</p> </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 internal" href="#">36.1. <tt class="docutils literal"><span class="pre">ic</span></tt> — Access to the Mac OS X Internet Config</a><ul> <li><a class="reference internal" href="#ic-objects">36.1.1. IC Objects</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="mac.html" title="previous chapter">36. Mac OS X specific services</a></p> <h4>Next topic</h4> <p class="topless"><a href="macos.html" title="next chapter">36.2. <tt class="docutils literal"><span class="pre">MacOS</span></tt> — Access to Mac OS interpreter features</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li><a href="../_sources/library/ic.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="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="macos.html" title="36.2. MacOS — Access to Mac OS interpreter features" >next</a> |</li> <li class="right" > <a href="mac.html" title="36. Mac OS X specific services" >previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> <li><a href="mac.html" >36. Mac OS X specific services</a> »</li> </ul> </div> <div class="footer"> © <a href="../copyright.html">Copyright</a> 1990-2019, 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 Jul 03, 2019. <a href="../bugs.html">Found a bug</a>? <br /> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>