source: vendor/python/2.5/Doc/mac/libmacic.tex

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

File size: 5.1 KB
Line 
1\section{\module{ic} ---
2 Access to Internet Config}
3
4\declaremodule{builtin}{ic}
5 \platform{Mac}
6\modulesynopsis{Access to Internet Config.}
7
8
9This module provides access to various internet-related preferences
10set through \program{System Preferences} or the \program{Finder}.
11
12There is a low-level companion module
13\module{icglue}\refbimodindex{icglue} which provides the basic
14Internet Config access functionality. This low-level module is not
15documented, but the docstrings of the routines document the parameters
16and the routine names are the same as for the Pascal or \C{} API to
17Internet Config, so the standard IC programmers' documentation can be
18used if this module is needed.
19
20The \module{ic} module defines the \exception{error} exception and
21symbolic names for all error codes Internet Config can produce; see
22the source for details.
23
24\begin{excdesc}{error}
25Exception raised on errors in the \module{ic} module.
26\end{excdesc}
27
28
29The \module{ic} module defines the following class and function:
30
31\begin{classdesc}{IC}{\optional{signature\optional{, ic}}}
32Create an Internet Config object. The signature is a 4-character creator
33code of the current application (default \code{'Pyth'}) which may
34influence some of ICs settings. The optional \var{ic} argument is a
35low-level \code{icglue.icinstance} created beforehand, this may be
36useful if you want to get preferences from a different config file,
37etc.
38\end{classdesc}
39
40\begin{funcdesc}{launchurl}{url\optional{, hint}}
41\funcline{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}}
42\funcline{mapfile}{file}
43\funcline{maptypecreator}{type, creator\optional{, filename}}
44\funcline{settypecreator}{file}
45These functions are ``shortcuts'' to the methods of the same name,
46described below.
47\end{funcdesc}
48
49
50\subsection{IC Objects}
51
52\class{IC} objects have a mapping interface, hence to obtain the mail
53address you simply get \code{\var{ic}['MailAddress']}. Assignment also
54works, and changes the option in the configuration file.
55
56The module knows about various datatypes, and converts the internal IC
57representation to a ``logical'' Python data structure. Running the
58\module{ic} module standalone will run a test program that lists all
59keys and values in your IC database, this will have to serve as
60documentation.
61
62If the module does not know how to represent the data it returns an
63instance of the \code{ICOpaqueData} type, with the raw data in its
64\member{data} attribute. Objects of this type are also acceptable values
65for assignment.
66
67Besides the dictionary interface, \class{IC} objects have the
68following methods:
69
70
71\begin{methoddesc}{launchurl}{url\optional{, hint}}
72Parse the given URL, launch the correct application and pass it the
73URL. The optional \var{hint} can be a scheme name such as
74\code{'mailto:'}, in which case incomplete URLs are completed with this
75scheme. If \var{hint} is not provided, incomplete URLs are invalid.
76\end{methoddesc}
77
78\begin{methoddesc}{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}}
79Find an URL somewhere in \var{data} and return start position, end
80position and the URL. The optional \var{start} and \var{end} can be
81used to limit the search, so for instance if a user clicks in a long
82text field you can pass the whole text field and the click-position in
83\var{start} and this routine will return the whole URL in which the
84user clicked. As above, \var{hint} is an optional scheme used to
85complete incomplete URLs.
86\end{methoddesc}
87
88\begin{methoddesc}{mapfile}{file}
89Return the mapping entry for the given \var{file}, which can be passed
90as either a filename or an \function{FSSpec()} result, and which
91need not exist.
92
93The mapping entry is returned as a tuple \code{(\var{version},
94\var{type}, \var{creator}, \var{postcreator}, \var{flags},
95\var{extension}, \var{appname}, \var{postappname}, \var{mimetype},
96\var{entryname})}, where \var{version} is the entry version
97number, \var{type} is the 4-character filetype, \var{creator} is the
984-character creator type, \var{postcreator} is the 4-character creator
99code of an
100optional application to post-process the file after downloading,
101\var{flags} are various bits specifying whether to transfer in binary
102or ascii and such, \var{extension} is the filename extension for this
103file type, \var{appname} is the printable name of the application to
104which this file belongs, \var{postappname} is the name of the
105postprocessing application, \var{mimetype} is the MIME type of this
106file and \var{entryname} is the name of this entry.
107\end{methoddesc}
108
109\begin{methoddesc}{maptypecreator}{type, creator\optional{, filename}}
110Return the mapping entry for files with given 4-character \var{type} and
111\var{creator} codes. The optional \var{filename} may be specified to
112further help finding the correct entry (if the creator code is
113\code{'????'}, for instance).
114
115The mapping entry is returned in the same format as for \var{mapfile}.
116\end{methoddesc}
117
118\begin{methoddesc}{settypecreator}{file}
119Given an existing \var{file}, specified either as a filename or as an
120\function{FSSpec()} result, set its creator and type correctly based
121on its extension. The finder is told about the change, so the finder
122icon will be updated quickly.
123\end{methoddesc}
Note: See TracBrowser for help on using the repository browser.