Show More
@@ -1,34 +1,34 b'' | |||||
1 | """ |
|
1 | """ | |
2 | Implementation of :class:`EchoApp`. |
|
2 | Implementation of :class:`EchoApp`. | |
3 |
|
3 | |||
4 | This WSGI application will just echo back the data which it recieves. |
|
4 | This WSGI application will just echo back the data which it recieves. | |
5 | """ |
|
5 | """ | |
6 |
|
6 | |||
7 | import logging |
|
7 | import logging | |
8 |
|
8 | |||
9 |
|
9 | |||
10 | log = logging.getLogger(__name__) |
|
10 | log = logging.getLogger(__name__) | |
11 |
|
11 | |||
12 |
|
12 | |||
13 | class EchoApp(object): |
|
13 | class EchoApp(object): | |
14 |
|
14 | |||
15 | def __init__(self, repo_path, repo_name, config): |
|
15 | def __init__(self, repo_path, repo_name, config): | |
16 | self._repo_path = repo_path |
|
16 | self._repo_path = repo_path | |
17 | log.info("EchoApp initialized for %s", repo_path) |
|
17 | log.info("EchoApp initialized for %s", repo_path) | |
18 |
|
18 | |||
19 | def __call__(self, environ, start_response): |
|
19 | def __call__(self, environ, start_response): | |
20 | log.debug("EchoApp called for %s", self._repo_path) |
|
20 | log.debug("EchoApp called for %s", self._repo_path) | |
21 | log.debug("Content-Length: %s", environ.get('CONTENT_LENGTH')) |
|
21 | log.debug("Content-Length: %s", environ.get('CONTENT_LENGTH')) | |
22 | environ['wsgi.input'].read() |
|
22 | environ['wsgi.input'].read() | |
23 | status = '200 OK' |
|
23 | status = '200 OK' | |
24 | headers = [] |
|
24 | headers = [('Content-Type', 'text/plain')] | |
25 | start_response(status, headers) |
|
25 | start_response(status, headers) | |
26 | return ["ECHO"] |
|
26 | return ["ECHO"] | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | def create_app(): |
|
29 | def create_app(): | |
30 | """ |
|
30 | """ | |
31 | Allows to run this app directly in a WSGI server. |
|
31 | Allows to run this app directly in a WSGI server. | |
32 | """ |
|
32 | """ | |
33 | stub_config = {} |
|
33 | stub_config = {} | |
34 | return EchoApp('stub_path', 'stub_name', stub_config) |
|
34 | return EchoApp('stub_path', 'stub_name', stub_config) |
General Comments 0
You need to be logged in to leave comments.
Login now