1
- # -- encoding: UTF-8 --
2
-
3
1
import re
4
2
import sys
5
3
6
- SVG_TEMPLATE = u """
4
+ SVG_TEMPLATE = """
7
5
<svg height="18" width="90" xmlns="http://www.w3.org/2000/svg">
8
6
<linearGradient id="a" x2="0" y2="100%%">
9
7
<stop offset="0" stop-color="#fff" stop-opacity=".7"/>
@@ -51,18 +49,15 @@ def simple_response(start_response, content, status_line="200 OK",
51
49
:param content_type: The content type header. Defaults to UTF-8 HTML.
52
50
:return: An iterable of content ready to be returned to the WSGI server.
53
51
"""
54
- if (sys .version_info > (3 , 0 )):
55
- content = str (content ).encode ("UTF-8" )
56
- else :
57
- content = unicode (content ).encode ("UTF-8" )
52
+ content = str (content ).encode ("UTF-8" )
58
53
start_response (status_line , [
59
54
("Content-Length" , str (len (content ))),
60
55
("Content-Type" , content_type )
61
56
])
62
57
return [content ]
63
58
64
59
65
- BAR_PATH_RE = re .compile ("^/bar/(\d+)$" )
60
+ BAR_PATH_RE = re .compile (r "^/bar/(\d+)$" )
66
61
67
62
68
63
def application (environ , start_response ):
@@ -82,10 +77,10 @@ def application(environ, start_response):
82
77
content_type = "image/svg+xml"
83
78
)
84
79
elif path == "/ping" :
85
- return simple_response (start_response , u "pong" )
80
+ return simple_response (start_response , "pong" )
86
81
else :
87
82
return simple_response (
88
- start_response , u "Not found." , status_line = "404 Not Found" )
83
+ start_response , "Not found." , status_line = "404 Not Found" )
89
84
90
85
91
86
def standalone ():
0 commit comments