-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtemplate.html
More file actions
93 lines (83 loc) · 3.63 KB
/
template.html
File metadata and controls
93 lines (83 loc) · 3.63 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html>
<head>
<title>template.py</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="dycco.css">
</head>
<body>
<div id="container">
<div id="background"></div>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="docs">
<h1>template.py</h1>
</th>
<th class="code">
</th>
</tr>
</thead>
<tbody>
<tr id="section-2">
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p>Template rendering sample application.</p>
<p>This renders the test.html file contained in the current working directory.</p>
</td>
<td class="code">
<div class="highlight"><pre>
</pre></div>
</td>
</tr>
<tr id="section-8">
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-8">¶</a>
</div>
</td>
<td class="code">
<div class="highlight"><pre><span class="k">def</span> <span class="nf">template</span><span class="p">(</span><span class="n">context</span><span class="p">):</span>
<span class="n">context</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">"Returning template result."</span><span class="p">)</span>
<span class="k">return</span> <span class="s">'mako:./template.html'</span><span class="p">,</span> <span class="nb">dict</span><span class="p">()</span>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">'__main__'</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">web.core</span> <span class="kn">import</span> <span class="n">Application</span>
<span class="kn">from</span> <span class="nn">web.ext.template</span> <span class="kn">import</span> <span class="n">TemplateExtension</span>
</pre></div>
</td>
</tr>
<tr id="section-18">
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-18">¶</a>
</div>
<p>Create the underlying WSGI application, passing the extensions to it.</p>
</td>
<td class="code">
<div class="highlight"><pre> <span class="n">app</span> <span class="o">=</span> <span class="n">Application</span><span class="p">(</span><span class="n">template</span><span class="p">,</span> <span class="n">extensions</span><span class="o">=</span><span class="p">[</span><span class="n">TemplateExtension</span><span class="p">()])</span>
</pre></div>
</td>
</tr>
<tr id="section-21">
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-21">¶</a>
</div>
<p>Start the development HTTP server.</p>
</td>
<td class="code">
<div class="highlight"><pre> <span class="n">app</span><span class="o">.</span><span class="n">serve</span><span class="p">(</span><span class="s">'wsgiref'</span><span class="p">)</span>
</pre></div>
</td>
</tr>
</tbody>
</table>
<footer>
Generated by <b><a href="http://mccutchen.github.com/dycco/">Dycco</a></b>.
Last updated <b>25 Apr 2016</b>.
</footer>
</div>
</body>
</html>