Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 0b7eb7009605a11593fbe388d7fbee61 > files > 931

python-docs-2.2-9.1mdk.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>2.5.1 IC Objects</title>
<META NAME="description" CONTENT="2.5.1 IC Objects">
<META NAME="keywords" CONTENT="mac">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=">
<link rel="STYLESHEET" href="mac.css">
<link rel="first" href="mac.html">
<link rel="contents" href="contents.html" title="Contents">
<link rel="index" href="genindex.html" title="Index">
<LINK REL="previous" href="module-ic.html">
<LINK REL="up" href="module-ic.html">
<LINK REL="next" href="module-MacOS.html">
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-ic.html"><img src="../icons/previous.gif"
  border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="module-ic.html"><img src="../icons/up.gif"
  border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="module-MacOS.html"><img src="../icons/next.gif"
  border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Macintosh Library Modules</td>
<td><A href="contents.html"><img src="../icons/contents.gif"
  border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" title="Module Index"><img src="../icons/modules.gif"
  border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html"><img src="../icons/index.gif"
  border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-ic.html">2.5 ic  </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-ic.html">2.5 ic  </A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-MacOS.html">2.6 MacOS  </A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION004510000000000000000">
2.5.1 IC Objects</A>
</H2>

<P>
<tt class="class">IC</tt> objects have a mapping interface, hence to obtain the mail
address you simply get <code><var>ic</var>['MailAddress']</code>. Assignment also
works, and changes the option in the configuration file.

<P>
The module knows about various datatypes, and converts the internal IC
representation to a ``logical'' Python data structure. Running the
<tt class="module">ic</tt> 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>
If the module does not know how to represent the data it returns an
instance of the <code>ICOpaqueData</code> type, with the raw data in its
<tt class="member">data</tt> attribute. Objects of this type are also acceptable values
for assignment.

<P>
Besides the dictionary interface, <tt class="class">IC</tt> objects have the
following methods:

<P>
<dl><dt><b><a name="l2h-77"><tt class="method">launchurl</tt></a></b>(<var>url</var><big>[</big><var>, hint</var><big>]</big>)
<dd>
Parse the given URL, lauch the correct application and pass it the
URL. The optional <var>hint</var> can be a scheme name such as
<code>'mailto:'</code>, in which case incomplete URLs are completed with this
scheme.  If <var>hint</var> is not provided, incomplete URLs are invalid.
</dl>

<P>
<dl><dt><b><a name="l2h-78"><tt class="method">parseurl</tt></a></b>(<var>data</var><big>[</big><var>, start</var><big>[</big><var>, end</var><big>[</big><var>, hint</var><big>]</big><big>]</big><big>]</big>)
<dd>
Find an URL somewhere in <var>data</var> and return start position, end
position and the URL. The optional <var>start</var> and <var>end</var> 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
<var>start</var> and this routine will return the whole URL in which the
user clicked.  As above, <var>hint</var> is an optional scheme used to
complete incomplete URLs.
</dl>

<P>
<dl><dt><b><a name="l2h-79"><tt class="method">mapfile</tt></a></b>(<var>file</var>)
<dd>
Return the mapping entry for the given <var>file</var>, which can be passed
as either a filename or an <tt class="function">macfs.FSSpec()</tt> result, and which
need not exist.

<P>
The mapping entry is returned as a tuple <code>(<var>version</var>,
<var>type</var>, <var>creator</var>, <var>postcreator</var>, <var>flags</var>,
<var>extension</var>, <var>appname</var>, <var>postappname</var>, <var>mimetype</var>,
<var>entryname</var>)</code>, where <var>version</var> is the entry version
number, <var>type</var> is the 4-character filetype, <var>creator</var> is the
4-character creator type, <var>postcreator</var> is the 4-character creator
code of an
optional application to post-process the file after downloading,
<var>flags</var> are various bits specifying whether to transfer in binary
or ascii and such, <var>extension</var> is the filename extension for this
file type, <var>appname</var> is the printable name of the application to
which this file belongs, <var>postappname</var> is the name of the
postprocessing application, <var>mimetype</var> is the MIME type of this
file and <var>entryname</var> is the name of this entry.
</dl>

<P>
<dl><dt><b><a name="l2h-80"><tt class="method">maptypecreator</tt></a></b>(<var>type, creator</var><big>[</big><var>, filename</var><big>]</big>)
<dd>
Return the mapping entry for files with given 4-character <var>type</var> and
<var>creator</var> codes. The optional <var>filename</var> may be specified to
further help finding the correct entry (if the creator code is
<code>'????'</code>, for instance).

<P>
The mapping entry is returned in the same format as for <var>mapfile</var>.
</dl>

<P>
<dl><dt><b><a name="l2h-81"><tt class="method">settypecreator</tt></a></b>(<var>file</var>)
<dd>
Given an existing <var>file</var>, specified either as a filename or as an
<tt class="function">macfs.FSSpec()</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.
</dl>

<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-ic.html"><img src="../icons/previous.gif"
  border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="module-ic.html"><img src="../icons/up.gif"
  border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="module-MacOS.html"><img src="../icons/next.gif"
  border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Macintosh Library Modules</td>
<td><A href="contents.html"><img src="../icons/contents.gif"
  border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" title="Module Index"><img src="../icons/modules.gif"
  border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html"><img src="../icons/index.gif"
  border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-ic.html">2.5 ic  </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-ic.html">2.5 ic  </A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-MacOS.html">2.6 MacOS  </A>
<hr>
<span class="release-info">Release 2.2, documentation updated on December 21, 2001.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>