4 <h1><a name=
"appengine" id=
"appengine">Appengine
</a></h1>
9 <a href=
"http://code.google.com/appengine/" class=
"urlextern" title=
"http://code.google.com/appengine/" rel=
"nofollow">Google Appengine
</a>
11 <div class=
"plugin_uparrow">
12 <a href=
"#" title=
"Back to top">
13 <img src=
"lib/plugins/uparrow/images/tango-small.png" alt=
"Back to top"/>
18 <!-- SECTION "Appengine" [1-81] -->
19 <h2><a name=
"example" id=
"example">Example
</a></h2>
21 <pre class=
"code python"><span class=
"kw1">from
</span> google.
<span class=
"me1">appengine
</span>.
<span class=
"me1">ext
</span> <span class=
"kw1">import
</span> webapp
22 <span class=
"kw1">from
</span> google.
<span class=
"me1">appengine
</span>.
<span class=
"me1">ext
</span>.
<span class=
"me1">webapp
</span>.
<span class=
"me1">util
</span> <span class=
"kw1">import
</span> run_wsgi_app
23 <span class=
"kw1">from
</span> google.
<span class=
"me1">appengine
</span>.
<span class=
"me1">ext
</span> <span class=
"kw1">import
</span> db
24 <span class=
"kw1">import
</span> <span class=
"kw3">urllib
</span>
25 <span class=
"kw1">from
</span> <span class=
"kw3">HTMLParser
</span> <span class=
"kw1">import
</span> <span class=
"kw3">HTMLParser
</span>
26 <span class=
"kw1">import
</span> <span class=
"kw3">re
</span>
28 <span class=
"kw1">class
</span> MyHTMLParser
<span class=
"br0">(</span><span class=
"kw3">HTMLParser
</span><span class=
"br0">)</span>:
29 <span class=
"kw1">def
</span> <span class=
"kw4">__init__
</span><span class=
"br0">(</span><span class=
"kw2">self
</span><span class=
"br0">)</span>:
30 <span class=
"kw3">HTMLParser
</span>.
<span class=
"kw4">__init__
</span><span class=
"br0">(</span><span class=
"kw2">self
</span><span class=
"br0">)</span>
31 <span class=
"kw2">self
</span>.
<span class=
"me1">s
</span> =
<span class=
"st0">''
</span>
33 <span class=
"kw1">def
</span> handle_starttag
<span class=
"br0">(</span><span class=
"kw2">self
</span>, tag, attrs
<span class=
"br0">)</span>:
34 <span class=
"kw1">if
</span> tag ==
<span class=
"st0">'embed'
</span>:
35 <span class=
"kw1">for
</span> attr
<span class=
"kw1">in
</span> attrs:
36 <span class=
"kw1">if
</span> attr
<span class=
"br0">[</span><span class=
"nu0">0</span><span class=
"br0">]</span> ==
<span class=
"st0">'flashvars'
</span>:
37 <span class=
"kw2">self
</span>.
<span class=
"me1">s
</span> = attr
<span class=
"br0">[</span>1<span class=
"br0">]</span>
39 <span class=
"kw1">def
</span> feed
<span class=
"br0">(</span><span class=
"kw2">self
</span>, data
<span class=
"br0">)</span>:
40 <span class=
"kw3">HTMLParser
</span>.
<span class=
"me1">feed
</span><span class=
"br0">(</span><span class=
"kw2">self
</span>, data
<span class=
"br0">)</span>
41 <span class=
"kw1">return
</span> <span class=
"kw2">self
</span>
43 <span class=
"kw1">def
</span> get_s
<span class=
"br0">(</span><span class=
"kw2">self
</span><span class=
"br0">)</span>:
44 <span class=
"kw1">return
</span> <span class=
"kw2">self
</span>.
<span class=
"me1">s
</span>
46 <span class=
"kw1">class
</span> Level
<span class=
"br0">(</span>db.
<span class=
"me1">Model
</span><span class=
"br0">)</span>:
47 content = db.
<span class=
"me1">TextProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
49 <span class=
"kw1">class
</span> Current
<span class=
"br0">(</span>db.
<span class=
"me1">Model
</span><span class=
"br0">)</span>:
50 x = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
51 y = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
52 d = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
53 n = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
54 m = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
55 l = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
57 <span class=
"kw1">class
</span> Wrong
<span class=
"br0">(</span>db.
<span class=
"me1">Model
</span><span class=
"br0">)</span>:
58 x = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
59 y = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
60 d = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
61 l = db.
<span class=
"me1">IntegerProperty
</span><span class=
"br0">(</span><span class=
"br0">)</span>
63 <span class=
"kw1">class
</span> CrossPage
<span class=
"br0">(</span>webapp.
<span class=
"me1">RequestHandler
</span><span class=
"br0">)</span>:
64 <span class=
"kw1">def
</span> get
<span class=
"br0">(</span><span class=
"kw2">self
</span><span class=
"br0">)</span>:
65 url =
<span class=
"st0">'http://www.hacker.org/cross/index.php?name=kauesilv
&password=a1b2c3d4'
</span>
66 regex = r
<span class=
"st0">'boardinit =
"([^
"]*)
"'
</span>
67 debug =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'debug'
</span><span class=
"br0">)</span>
68 s =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'s'
</span><span class=
"br0">)</span>
69 path =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'path'
</span><span class=
"br0">)</span>
70 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">headers
</span><span class=
"br0">[</span><span class=
"st0">'Content-Type'
</span><span class=
"br0">]</span> =
<span class=
"st0">'text/plain'
</span>
71 <span class=
"kw1">if
</span> s ==
<span class=
"st0">'
1'
</span>:
72 <span class=
"kw3">urllib
</span>.
<span class=
"me1">urlopen
</span><span class=
"br0">(</span>url +
<span class=
"st0">'
&sol='
</span> + path
<span class=
"br0">)</span>.
<span class=
"me1">read
</span><span class=
"br0">(</span><span class=
"br0">)</span>
73 s =
<span class=
"kw3">urllib
</span>.
<span class=
"me1">urlopen
</span><span class=
"br0">(</span>url
<span class=
"br0">)</span>.
<span class=
"me1">read
</span><span class=
"br0">(</span><span class=
"br0">)</span>
74 <span class=
"co1">#self.response.out.write(s + '\n')
</span>
75 board =
<span class=
"kw3">re
</span>.
<span class=
"kw2">compile
</span><span class=
"br0">(</span>regex
<span class=
"br0">)</span>.
<span class=
"me1">search
</span><span class=
"br0">(</span>s
<span class=
"br0">)</span>.
<span class=
"me1">groups
</span><span class=
"br0">(</span><span class=
"br0">)</span><span class=
"br0">[</span><span class=
"nu0">0</span><span class=
"br0">]</span>.
<span class=
"me1">split
</span><span class=
"br0">(</span><span class=
"st0">','
</span><span class=
"br0">)</span>
76 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">out
</span>.
<span class=
"me1">write
</span><span class=
"br0">(</span><span class=
"kw2">str
</span><span class=
"br0">(</span><span class=
"kw2">len
</span><span class=
"br0">(</span>board
<span class=
"br0">)</span><span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span><span class=
"kw2">len
</span><span class=
"br0">(</span>board
<span class=
"br0">[</span><span class=
"nu0">0</span><span class=
"br0">]</span><span class=
"br0">)</span><span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span><span class=
"br0">)</span>
77 <span class=
"kw1">for
</span> line
<span class=
"kw1">in
</span> board:
78 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">out
</span>.
<span class=
"me1">write
</span><span class=
"br0">(</span><span class=
"kw2">str
</span><span class=
"br0">(</span>line
<span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span><span class=
"br0">)</span>
80 <span class=
"kw1">class
</span> MainPage
<span class=
"br0">(</span>webapp.
<span class=
"me1">RequestHandler
</span><span class=
"br0">)</span>:
81 <span class=
"kw1">def
</span> get
<span class=
"br0">(</span><span class=
"kw2">self
</span><span class=
"br0">)</span>:
82 delete =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'delete'
</span><span class=
"br0">)</span>
83 <span class=
"kw1">if
</span> delete ==
<span class=
"st0">'
1'
</span>:
84 db.
<span class=
"me1">delete
</span><span class=
"br0">(</span>Wrong.
<span class=
"kw2">all
</span><span class=
"br0">(</span><span class=
"br0">)</span>.
<span class=
"me1">fetch
</span><span class=
"br0">(</span>100<span class=
"br0">)</span><span class=
"br0">)</span>
85 <span class=
"kw1">if
</span> Wrong.
<span class=
"kw2">all
</span><span class=
"br0">(</span><span class=
"br0">)</span>.
<span class=
"me1">count
</span><span class=
"br0">(</span>1<span class=
"br0">)</span> ==
1:
86 <span class=
"kw1">return
</span>
88 url =
<span class=
"st0">'http://www.hacker.org/coil/index.php?name=kauesilv
&password=a1b2c3d4'
</span>
89 regex = r
<span class=
"st0">'x=(
<span class=
"es0">\d
</span>*)
&y=(
<span class=
"es0">\d
</span>*)
&board=(.*)'
</span>
90 regexLevel = r
<span class=
"st0">'Level: (
<span class=
"es0">\d
</span>*)'
</span>
91 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">headers
</span><span class=
"br0">[</span><span class=
"st0">'Content-Type'
</span><span class=
"br0">]</span> =
<span class=
"st0">'text/plain'
</span>
92 debug =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'debug'
</span><span class=
"br0">)</span>
93 s =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'s'
</span><span class=
"br0">)</span>
94 r =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'r'
</span><span class=
"br0">)</span>
95 x =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'x'
</span><span class=
"br0">)</span>
96 y =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'y'
</span><span class=
"br0">)</span>
97 d =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'d'
</span><span class=
"br0">)</span>
98 w =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'w'
</span><span class=
"br0">)</span>
99 path =
<span class=
"kw2">self
</span>.
<span class=
"me1">request
</span>.
<span class=
"me1">get
</span><span class=
"br0">(</span><span class=
"st0">'path'
</span><span class=
"br0">)</span>
101 levels = Level.
<span class=
"kw2">all
</span><span class=
"br0">(</span><span class=
"br0">)</span>
102 currents = Current.
<span class=
"kw2">all
</span><span class=
"br0">(</span><span class=
"br0">)</span>
104 <span class=
"kw1">if
</span> s ==
<span class=
"st0">'
1'
</span>:
105 <span class=
"kw3">urllib
</span>.
<span class=
"me1">urlopen
</span><span class=
"br0">(</span>url +
<span class=
"st0">'
&x='
</span> + x +
<span class=
"st0">'
&y='
</span> + y +
<span class=
"st0">'
&path='
</span> + path
<span class=
"br0">)</span>.
<span class=
"me1">read
</span><span class=
"br0">(</span><span class=
"br0">)</span>
107 <span class=
"kw1">if
</span> w ==
<span class=
"st0">'
1'
</span>:
108 wrong = Wrong
<span class=
"br0">(</span><span class=
"br0">)</span>
109 wrong.
<span class=
"me1">x
</span> =
<span class=
"kw2">int
</span><span class=
"br0">(</span>x
<span class=
"br0">)</span>
110 wrong.
<span class=
"me1">y
</span> =
<span class=
"kw2">int
</span><span class=
"br0">(</span>y
<span class=
"br0">)</span>
111 wrong.
<span class=
"me1">d
</span> =
<span class=
"kw2">int
</span><span class=
"br0">(</span>d
<span class=
"br0">)</span>
112 wrong.
<span class=
"me1">l
</span> = currents.
<span class=
"me1">fetch
</span><span class=
"br0">(</span>1<span class=
"br0">)</span><span class=
"br0">[</span>0<span class=
"br0">]</span>.
<span class=
"me1">l
</span>
113 wrong.
<span class=
"me1">put
</span><span class=
"br0">(</span><span class=
"br0">)</span>
115 <span class=
"kw1">if
</span> s ==
<span class=
"st0">'
1'
</span> <span class=
"kw1">or
</span> r ==
<span class=
"st0">'
1'
</span>:
116 s =
<span class=
"kw3">urllib
</span>.
<span class=
"me1">urlopen
</span><span class=
"br0">(</span>url
<span class=
"br0">)</span>.
<span class=
"me1">read
</span><span class=
"br0">(</span><span class=
"br0">)</span>
117 x, y, board =
<span class=
"kw3">re
</span>.
<span class=
"kw2">compile
</span><span class=
"br0">(</span>regex
<span class=
"br0">)</span>.
<span class=
"me1">search
</span><span class=
"br0">(</span>MyHTMLParser
<span class=
"br0">(</span><span class=
"br0">)</span>.
<span class=
"me1">feed
</span><span class=
"br0">(</span>s
<span class=
"br0">)</span>.
<span class=
"me1">get_s
</span><span class=
"br0">(</span><span class=
"br0">)</span><span class=
"br0">)</span>.
<span class=
"me1">groups
</span><span class=
"br0">(</span><span class=
"br0">)</span>
118 lvl, =
<span class=
"kw3">re
</span>.
<span class=
"kw2">compile
</span><span class=
"br0">(</span>regexLevel
<span class=
"br0">)</span>.
<span class=
"me1">search
</span><span class=
"br0">(</span>s
<span class=
"br0">)</span>.
<span class=
"me1">groups
</span><span class=
"br0">(</span><span class=
"br0">)</span>
119 db.
<span class=
"me1">delete
</span><span class=
"br0">(</span>Level.
<span class=
"kw2">all
</span><span class=
"br0">(</span><span class=
"br0">)</span>.
<span class=
"me1">fetch
</span><span class=
"br0">(</span>1000000<span class=
"br0">)</span><span class=
"br0">)</span>
120 db.
<span class=
"me1">delete
</span><span class=
"br0">(</span>Current.
<span class=
"kw2">all
</span><span class=
"br0">(</span><span class=
"br0">)</span>.
<span class=
"me1">fetch
</span><span class=
"br0">(</span><span class=
"nu0">1000000</span><span class=
"br0">)</span><span class=
"br0">)</span>
122 level = Level
<span class=
"br0">(</span><span class=
"br0">)</span>
123 level.
<span class=
"me1">content
</span> = x +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span> + y +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span> + board +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span>
124 level.
<span class=
"me1">put
</span><span class=
"br0">(</span><span class=
"br0">)</span>
126 current = Current
<span class=
"br0">(</span><span class=
"br0">)</span>
127 current.
<span class=
"me1">x
</span> = current.
<span class=
"me1">y
</span> = current.
<span class=
"me1">d
</span> =
0
128 current.
<span class=
"me1">n
</span> =
<span class=
"kw2">int
</span><span class=
"br0">(</span>x
<span class=
"br0">)</span>
129 current.
<span class=
"me1">m
</span> =
<span class=
"kw2">int
</span><span class=
"br0">(</span>y
<span class=
"br0">)</span>
130 current.
<span class=
"me1">l
</span> =
<span class=
"kw2">int
</span><span class=
"br0">(</span>lvl
<span class=
"br0">)</span>
131 current.
<span class=
"me1">put
</span><span class=
"br0">(</span><span class=
"br0">)</span>
133 cur = currents.
<span class=
"me1">fetch
</span><span class=
"br0">(</span>1<span class=
"br0">)</span><span class=
"br0">[</span>0<span class=
"br0">]</span>
134 <span class=
"kw1">while
</span><span class=
"br0">(</span><span class=
"kw2">True
</span><span class=
"br0">)</span>:
135 cur.
<span class=
"me1">d
</span> = cur.
<span class=
"me1">d
</span> +
1
136 <span class=
"kw1">if
</span><span class=
"br0">(</span>cur.
<span class=
"me1">d
</span> ==
4<span class=
"br0">)</span>:
137 cur.
<span class=
"me1">d
</span> =
0
138 cur.
<span class=
"me1">y
</span> = cur.
<span class=
"me1">y
</span> +
1
139 <span class=
"kw1">if
</span><span class=
"br0">(</span>cur.
<span class=
"me1">y
</span> == cur.
<span class=
"me1">m
</span><span class=
"br0">)</span>:
140 cur.
<span class=
"me1">y
</span> =
0
141 cur.
<span class=
"me1">x
</span> = cur.
<span class=
"me1">x
</span> +
1
142 <span class=
"kw1">if
</span><span class=
"br0">(</span>cur.
<span class=
"me1">x
</span> == cur.
<span class=
"me1">n
</span><span class=
"br0">)</span>:
143 cur.
<span class=
"me1">x
</span> =
<span class=
"nu0">0</span>
144 cur.
<span class=
"me1">put
</span><span class=
"br0">(</span><span class=
"br0">)</span>
145 wrong = Wrong
<span class=
"br0">(</span><span class=
"br0">)</span>.
<span class=
"me1">gql
</span><span class=
"br0">(</span><span class=
"st0">"WHERE x = :
1 AND y = :
2 AND d = :
3 AND l = :
4"</span>, cur.
<span class=
"me1">x
</span>, cur.
<span class=
"me1">y
</span>, cur.
<span class=
"me1">d
</span>, cur.
<span class=
"me1">l
</span><span class=
"br0">)</span>
146 <span class=
"kw1">if
</span><span class=
"br0">(</span>wrong.
<span class=
"me1">count
</span><span class=
"br0">(</span>1<span class=
"br0">)</span> ==
0<span class=
"br0">)</span>:
147 <span class=
"kw1">break
</span>
149 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">out
</span>.
<span class=
"me1">write
</span><span class=
"br0">(</span><span class=
"kw2">str
</span><span class=
"br0">(</span>cur.
<span class=
"me1">x
</span><span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>cur.
<span class=
"me1">y
</span><span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>cur.
<span class=
"me1">d
</span><span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>cur.
<span class=
"me1">l
</span><span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span><span class=
"br0">)</span>
150 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">out
</span>.
<span class=
"me1">write
</span><span class=
"br0">(</span>levels.
<span class=
"me1">fetch
</span><span class=
"br0">(</span>1<span class=
"br0">)</span><span class=
"br0">[</span>0<span class=
"br0">]</span>.
<span class=
"me1">content
</span><span class=
"br0">)</span>
152 <span class=
"kw1">if
</span> debug ==
<span class=
"st0">'
1'
</span>:
153 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">out
</span>.
<span class=
"me1">write
</span><span class=
"br0">(</span><span class=
"st0">'
<span class=
"es0">\n
</span><span class=
"es0">\n
</span>----DEBUG----
<span class=
"es0">\n
</span><span class=
"es0">\n
</span>wrongs
<span class=
"es0">\n
</span>'
</span><span class=
"br0">)</span>
154 wrongs = Wrong.
<span class=
"me1">gql
</span><span class=
"br0">(</span><span class=
"st0">"WHERE l = :
1"</span>, cur.
<span class=
"me1">l
</span><span class=
"br0">)</span>
155 <span class=
"kw1">for
</span> wrong
<span class=
"kw1">in
</span> wrongs:
156 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">out
</span>.
<span class=
"me1">write
</span><span class=
"br0">(</span><span class=
"kw2">str
</span><span class=
"br0">(</span>wrong.
<span class=
"me1">x
</span><span class=
"br0">)</span> +
<span class=
"st0">' '
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>wrong.
<span class=
"me1">y
</span><span class=
"br0">)</span> +
<span class=
"st0">' '
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>wrong.
<span class=
"me1">d
</span><span class=
"br0">)</span> +
<span class=
"st0">' '
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>wrong.
<span class=
"me1">l
</span><span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span><span class=
"br0">)</span>
158 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">out
</span>.
<span class=
"me1">write
</span><span class=
"br0">(</span><span class=
"st0">'
<span class=
"es0">\n
</span>currents
<span class=
"es0">\n
</span>'
</span><span class=
"br0">)</span>
159 <span class=
"kw1">for
</span> current
<span class=
"kw1">in
</span> currents:
160 <span class=
"kw2">self
</span>.
<span class=
"me1">response
</span>.
<span class=
"me1">out
</span>.
<span class=
"me1">write
</span><span class=
"br0">(</span><span class=
"kw2">str
</span><span class=
"br0">(</span>current.
<span class=
"me1">x
</span><span class=
"br0">)</span> +
<span class=
"st0">' '
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>current.
<span class=
"me1">y
</span><span class=
"br0">)</span> +
<span class=
"st0">' '
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>current.
<span class=
"me1">d
</span><span class=
"br0">)</span> +
<span class=
"st0">' '
</span> +
<span class=
"kw2">str
</span><span class=
"br0">(</span>current.
<span class=
"me1">l
</span><span class=
"br0">)</span> +
<span class=
"st0">'
<span class=
"es0">\n
</span>'
</span><span class=
"br0">)</span>
162 application = webapp.
<span class=
"me1">WSGIApplication
</span><span class=
"br0">(</span><span class=
"br0">[</span><span class=
"br0">(</span><span class=
"st0">'/'
</span>, MainPage
<span class=
"br0">)</span>,
<span class=
"br0">(</span><span class=
"st0">'/cross'
</span>, CrossPage
<span class=
"br0">)</span><span class=
"br0">]</span>, debug=
<span class=
"kw2">True
</span><span class=
"br0">)</span>
164 <span class=
"kw1">def
</span> main
<span class=
"br0">(</span><span class=
"br0">)</span>:
165 run_wsgi_app
<span class=
"br0">(</span>application
<span class=
"br0">)</span>
167 <span class=
"kw1">if
</span> __name__ ==
<span class=
"st0">"__main__
"</span>:
168 main
<span class=
"br0">(</span><span class=
"br0">)</span></pre>
169 <div class=
"plugin_uparrow">
170 <a href=
"#" title=
"Back to top">
171 <img src=
"lib/plugins/uparrow/images/tango-small.png" alt=
"Back to top"/>
176 <!-- SECTION "Example" [82-] -->