blob: 34fe7b704147a54ffda57b0e32d803a3b4904726 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Twisted Documentation: Glossary</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body bgcolor="white">
<h1 class="title">Glossary</h1>
<div class="toc"><ol/></div>
<div class="content">
<span/>
<p class="note"><strong>Note: </strong>This glossary is very incomplete. Contributions are
welcome.</p>
<dl>
<dt><a name="resource" shape="rect">resource</a></dt>
<dd>
An object accessible via HTTP at one or more URIs. In Twisted Web,
a resource is represented by an object which provides <code class="API"><a href="http://twistedmatrix.com/documents/12.1.0/api/twisted.web.resource.IResource.html" title="twisted.web.resource.IResource">twisted.web.resource.IResource</a></code> and most often is
a subclass of <code class="API"><a href="http://twistedmatrix.com/documents/12.1.0/api/twisted.web.resource.Resource.html" title="twisted.web.resource.Resource">twisted.web.resource.Resource</a></code>. For example, here
is a resource which represents a simple HTML greeting.
<pre class="python"><p class="py-linenumber">1
2
3
4
5
</p><span class="py-src-keyword">from</span> <span class="py-src-variable">twisted</span>.<span class="py-src-variable">web</span>.<span class="py-src-variable">resource</span> <span class="py-src-keyword">import</span> <span class="py-src-variable">Resource</span>
<span class="py-src-keyword">class</span> <span class="py-src-identifier">Greeting</span>(<span class="py-src-parameter">Resource</span>):
<span class="py-src-keyword">def</span> <span class="py-src-identifier">render_GET</span>(<span class="py-src-parameter">self</span>, <span class="py-src-parameter">request</span>):
<span class="py-src-keyword">return</span> <span class="py-src-string">"Hello, world."</span>
</pre>
</dd>
</dl>
</div>
<p><a href="index.html">Index</a></p>
<span class="version">Version: 12.1.0</span>
</body>
</html>
|