~unity-2d-team/unity-2d/Shell-MultiMonitor

7 by William Grant
Add trivial WSGI app and test.
1
# Copyright (c) 2011 Canonical Ltd
2
#
3
# This program is free software: you can redistribute it and/or modify
4
# it under the terms of the GNU Affero General Public License as published by
5
# the Free Software Foundation, either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU Affero General Public License for more details.
12
#
13
# You should have received a copy of the GNU Affero General Public
14
# License along with this program. If not, see
15
# <http://www.gnu.org/licenses/>.
16
17
__metaclass__ = type
18
19
import web
20
21
22
class root:
23
24
    def GET(self):
25
        web.header('Content-Type', 'text/plain')
26
        return (
27
            'Service endpoint for Grackle.\n\n'
28
            'When you want mail that was archived in Grackle, you can get it '
29
            'from Grackle')
30
31
32
class archive:
33
34
    def GET(self, name):
35
        web.header('Content-Type', 'text/plain')
36
        return ('Service for archive %s.' % name)
37
38
39
urls = (
40
    '/', 'root',
41
    '/archive/(.+)', 'archive',
42
    )
43
44
app = web.application(urls, globals(), autoreload=False)
45
46
if __name__ == "__main__":
47
    app.run()