~gary/python-openid/python-openid-2.2.1-patched

« back to all changes in this revision

Viewing changes to doc/openid.consumer.html_parse-module.html

  • Committer: Launchpad Patch Queue Manager
  • Date: 2007-11-30 02:46:28 UTC
  • mfrom: (1.1.1 pyopenid-2.0)
  • Revision ID: launchpad@pqm.canonical.com-20071130024628-qktwsew3383iawmq
[rs=SteveA] upgrade to python-openid-2.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
3
          "DTD/xhtml1-transitional.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<head>
 
6
  <title>openid.consumer.html_parse</title>
 
7
  <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
 
8
</head>
 
9
<body bgcolor="white" text="black" link="blue" vlink="#204080"
 
10
      alink="#204080">
 
11
 
 
12
<!-- =========== START OF NAVBAR =========== -->
 
13
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
 
14
  <tr valign="center">
 
15
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="openid-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
 
16
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
 
17
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
 
18
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
 
19
    <th class="navbar" align="right" width="100%">
 
20
      <table border="0" cellpadding="0" cellspacing="0">
 
21
      <tr><th class="navbar" align="center">
 
22
        <p class="nomargin">
 
23
          <a class="navbar" target="_top" href="http://www.openidenabled.com/">Python-OpenID</a>
 
24
      </p></th></tr></table>
 
25
    </th>
 
26
  </tr>
 
27
</table>
 
28
<table width="100%" cellpadding="0" cellspacing="0">
 
29
  <tr valign="top">
 
30
    <td width="100%">
 
31
      <font size="-1"><b class="breadcrumbs">
 
32
        <a href="openid-module.html">Package&nbsp;openid</a> ::
 
33
        <a href="openid.consumer-module.html">Package&nbsp;consumer</a> ::
 
34
        Module&nbsp;html_parse
 
35
      </b></font></br>
 
36
    </td>
 
37
    <td><table cellpadding="0" cellspacing="0">
 
38
      <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="openid.consumer.html_parse-module.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
 
39
    </table></td>
 
40
</tr></table>
 
41
 
 
42
<!-- =========== START OF MODULE DESCRIPTION =========== -->
 
43
<h2 class="module">Module openid.consumer.html_parse</h2>
 
44
 
 
45
This module implements a VERY limited parser that finds &lt;link&gt; 
 
46
tags in the head of HTML or XHTML documents and parses out their 
 
47
attributes according to the OpenID spec. It is a liberal parser, but it 
 
48
requires these things from the data in order to work:
 
49
<ul>
 
50
  <li>
 
51
    There must be an open &lt;html&gt; tag
 
52
  </li>
 
53
  <li>
 
54
    There must be an open &lt;head&gt; tag inside of the &lt;html&gt; 
 
55
    tag
 
56
  </li>
 
57
  <li>
 
58
    Only &lt;link&gt;s that are found inside of the &lt;head&gt; tag 
 
59
    are parsed (this is by design)
 
60
  </li>
 
61
  <li>
 
62
    The parser follows the OpenID specification in resolving the 
 
63
    attributes of the link tags. This means that the attributes DO NOT 
 
64
    get resolved as they would by an XML or HTML parser. In particular, 
 
65
    only certain entities get replaced, and href attributes do not get 
 
66
    resolved relative to a base URL.
 
67
  </li>
 
68
</ul>
 
69
From http://openid.net/specs.bml#linkrel:
 
70
<ul>
 
71
  <li>
 
72
    The openid.server URL MUST be an absolute URL. OpenID consumers 
 
73
    MUST NOT attempt to resolve relative URLs.
 
74
  </li>
 
75
  <li>
 
76
    The openid.server URL MUST NOT include entities other than 
 
77
    &amp;amp;, &amp;lt;, &amp;gt;, and &amp;quot;.
 
78
  </li>
 
79
</ul>
 
80
<p>The parser ignores SGML comments and &lt;![CDATA[blocks]]&gt;. Both 
 
81
kinds of quoting are allowed for attributes.</p>
 
82
The parser deals with invalid markup in these ways:
 
83
<ul>
 
84
  <li>
 
85
    Tag names are not case-sensitive
 
86
  </li>
 
87
  <li>
 
88
    The &lt;html&gt; tag is accepted even when it is not at the top 
 
89
    level
 
90
  </li>
 
91
  <li>
 
92
    The &lt;head&gt; tag is accepted even when it is not a direct 
 
93
    child of the &lt;html&gt; tag, but a &lt;html&gt; tag must be an 
 
94
    ancestor of the &lt;head&gt; tag
 
95
  </li>
 
96
  <li>
 
97
    &lt;link&gt; tags are accepted even when they are not direct 
 
98
    children of the &lt;head&gt; tag, but a &lt;head&gt; tag must be an 
 
99
    ancestor of the &lt;link&gt; tag
 
100
  </li>
 
101
  <li>
 
102
    If there is no closing tag for an open &lt;html&gt; or 
 
103
    &lt;head&gt; tag, the remainder of the document is viewed as being 
 
104
    inside of the tag. If there is no closing tag for a &lt;link&gt; tag, 
 
105
    the link tag is treated as a short tag. Exceptions to this rule are 
 
106
    that &lt;html&gt; closes &lt;html&gt; and &lt;body&gt; or 
 
107
    &lt;head&gt; closes &lt;head&gt;
 
108
  </li>
 
109
  <li>
 
110
    Attributes of the &lt;link&gt; tag are not required to be 
 
111
    quoted.
 
112
  </li>
 
113
  <li>
 
114
    In the case of duplicated attribute names, the attribute coming 
 
115
    last in the tag will be the value returned.
 
116
  </li>
 
117
  <li>
 
118
    Any text that does not parse as an attribute within a link tag 
 
119
    will be ignored. (e.g. &lt;link pumpkin rel='openid.server' /&gt; 
 
120
    will ignore pumpkin)
 
121
  </li>
 
122
  <li>
 
123
    If there are more than one &lt;html&gt; or &lt;head&gt; tag, the 
 
124
    parser only looks inside of the first one.
 
125
  </li>
 
126
  <li>
 
127
    The contents of &lt;script&gt; tags are ignored entirely, except 
 
128
    unclosed &lt;script&gt; tags. Unclosed &lt;script&gt; tags are 
 
129
    ignored.
 
130
  </li>
 
131
  <li>
 
132
    Any other invalid markup is ignored, including unclosed SGML 
 
133
    comments and unclosed &lt;![CDATA[blocks.
 
134
  </li>
 
135
</ul>
 
136
<hr/>
 
137
 
 
138
<!-- =========== START OF FUNCTION SUMMARY =========== -->
 
139
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
 
140
<tr bgcolor="#70b0f0" class="summary">
 
141
  <th colspan="2">Function Summary</th></tr>
 
142
<tr><td align="right" valign="top" width="15%"><font size="-1">        [[(type(html), type(html))]]
 
143
</font></td>
 
144
  <td><code><span class="summary-sig"><a href="openid.consumer.html_parse-module.html#parseLinkAttrs" class="summary-sig-name"><code>parseLinkAttrs</code></a>(<span class=summary-sig-arg>html</span>)</span></code>
 
145
<br />
 
146
Find all link tags in a string representing a HTML document and return 
 
147
a list of their attributes.</td></tr>
 
148
</table><br />
 
149
 
 
150
 
 
151
<!-- =========== START OF FUNCTION DETAILS =========== -->
 
152
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
 
153
<tr bgcolor="#70b0f0" class="details">
 
154
  <th colspan="2">Function Details</th></tr>
 
155
</table>
 
156
 
 
157
<a name="parseLinkAttrs"></a>
 
158
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
 
159
  <h3><span class="sig"><span class="sig-name">parseLinkAttrs</span>(<span class=sig-arg>html</span>)</span>
 
160
  </h3>
 
161
  Find all link tags in a string representing a HTML document and 
 
162
  return a list of their attributes.
 
163
  <dl><dt></dt><dd>
 
164
    <dl><dt><b>Parameters:</b></dt>
 
165
      <dd><code><b>html</b></code> -
 
166
         the text to parse
 
167
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
168
        (type=str or unicode)</i>
 
169
      </dd>
 
170
    </dl>
 
171
    <dl><dt><b>Returns:</b></dt>
 
172
      <dd>
 
173
        A list of dictionaries of attributes, one for each link 
 
174
        tag
 
175
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
176
        (type=[[(type(html), type(html))]])</i>
 
177
      </dd>
 
178
    </dl>
 
179
  </dd></dl>
 
180
</td></tr></table>
 
181
<br />
 
182
 
 
183
 
 
184
<!-- =========== START OF NAVBAR =========== -->
 
185
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
 
186
  <tr valign="center">
 
187
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="openid-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
 
188
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
 
189
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
 
190
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
 
191
    <th class="navbar" align="right" width="100%">
 
192
      <table border="0" cellpadding="0" cellspacing="0">
 
193
      <tr><th class="navbar" align="center">
 
194
        <p class="nomargin">
 
195
          <a class="navbar" target="_top" href="http://www.openidenabled.com/">Python-OpenID</a>
 
196
      </p></th></tr></table>
 
197
    </th>
 
198
  </tr>
 
199
</table>
 
200
 
 
201
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
202
  <tr>
 
203
    <td align="left"><font size="-2">Generated by Epydoc 2.1 on Mon Sep 10 13:00:12 2007</font></td>
 
204
    <td align="right"><a href="http://epydoc.sourceforge.net"
 
205
                      ><font size="-2">http://epydoc.sf.net</font></a></td>
 
206
  </tr>
 
207
</table>
 
208
</body>
 
209
</html>