<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"mac.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"mac.html" title='Macintosh Library Modules'
/>
<link rel='contents' href='contents.html'
title=
"Contents" />
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"prev" href=
"module-ic.html" />
<link rel=
"parent" href=
"module-ic.html" />
<link rel=
"next" href=
"module-MacOS.html" />
<meta name='aesop' content='information'
/>
<title>2.3.1 IC Objects
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"2.3 ic "
href=
"module-ic.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"2.3 ic "
href=
"module-ic.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"2.4 MacOS "
href=
"module-MacOS.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Macintosh Library Modules
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-ic.html">2.3 ic
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"module-ic.html">2.3 ic
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"module-MacOS.html">2.4 MacOS
</A>
<!--End of Navigation Panel-->
<H2><A NAME=
"SECTION004310000000000000000">
<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.
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
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
Besides the dictionary interface,
<tt class=
"class">IC
</tt> objects have the
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
47' xml:id='l2h-
47'
class=
"method">launchurl
</tt></b>(
</nobr></td>
<td><var>url
</var><big>[
</big><var>, hint
</var><big>]
</big><var></var>)
</td></tr></table></dt>
Parse the given URL, launch 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><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
48' xml:id='l2h-
48'
class=
"method">parseurl
</tt></b>(
</nobr></td>
<td><var>data
</var><big>[
</big><var>, start
</var><big>[
</big><var>, end
</var><big>[
</big><var>, hint
</var><big>]
</big><var></var><big>]
</big><var></var><big>]
</big><var></var>)
</td></tr></table></dt>
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><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
49' xml:id='l2h-
49'
class=
"method">mapfile
</tt></b>(
</nobr></td>
<td><var>file
</var>)
</td></tr></table></dt>
Return the mapping entry for the given
<var>file
</var>, which can be passed
as either a filename or an
<tt class=
"function">FSSpec()
</tt> result, and which
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
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><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
50' xml:id='l2h-
50'
class=
"method">maptypecreator
</tt></b>(
</nobr></td>
<td><var>type, creator
</var><big>[
</big><var>, filename
</var><big>]
</big><var></var>)
</td></tr></table></dt>
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).
The mapping entry is returned in the same format as for
<var>mapfile
</var>.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
51' xml:id='l2h-
51'
class=
"method">settypecreator
</tt></b>(
</nobr></td>
<td><var>file
</var>)
</td></tr></table></dt>
Given an existing
<var>file
</var>, specified either as a filename or as an
<tt class=
"function">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.
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"2.3 ic "
href=
"module-ic.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"2.3 ic "
href=
"module-ic.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"2.4 MacOS "
href=
"module-MacOS.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Macintosh Library Modules
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-ic.html">2.3 ic
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"module-ic.html">2.3 ic
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"module-MacOS.html">2.4 MacOS
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.