~ubuntu-branches/ubuntu/trusty/uwsgi/trusty

« back to all changes in this revision

Viewing changes to welcome3.py

  • Committer: Package Import Robot
  • Author(s): Janos Guljas
  • Date: 2012-02-13 03:43:28 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120213034328-d02hz8m5pon6kaxf
Tags: 1.0.3+dfsg-1
* New upstream version.
* Adjust rack plugin LD_RUN_PATH patch.
* Adjust patch for uWSGI Control Center jQuery links in templates.
* Remove '-fno-strict-aliasing' CFLAG patch as it is implemented upstream.
* Remove fix indentation of uwsgidecorators_py patch as implemented upstream.
* Adjust init scripts to use top-bottom options order, as --inherit option
  is not working as in earlier versions. 
* Update debian/copyright file.
* Add LSB Description field to debian/uwsgi.init.d.
* Set Architecture to "all" for binary package uwsgi-extra because
  it contains no architecture dependent files.
* Change uwsgi description. (Closes: #640698)
* New binary packages:
  - uwsgi-plugin-carbon
  - uwsgi-plugin-graylog2
  - uwsgi-plugin-logsocket
  - uwsgi-plugin-probeconnect
  - uwsgi-plugin-probepg
  - uwsgi-plugin-rrdtool
  - uwsgi-plugin-rsyslog
  - uwsgi-plugin-signal
  - uwsgi-plugin-symcall
  - uwsgi-plugin-syslog
* python-uwsgidecorators:
  - fix binary-install rule to call dh_python2
  - remove debian/source.lintian-overrides
* uwsgi-plugin-jvm-openjdk-6:
  - fix FTBFS on armel and powerpc (Closes: #656280)
* uwsgi-plugin-python:
  - document issue "ImportError: No module named site" when using
    virtualenv with Python 2.6 in README.Debian (Closes: #654333)
* Adjust debian/watch uversionmangle option.
* Repack upstram source to remove minimized jQuery and jQuery UI JavaScript
  libraries:
  - add get-orig-source rule to debian/rules
  - append +dfsg to upstream version
  - update debian/watch with dversionmangle option

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import uwsgi
 
2
import os
 
3
 
 
4
def xsendfile(e, sr):
 
5
    sr('200 OK', [('Content-Type', 'image/png'), ('X-Sendfile', os.path.abspath('logo_uWSGI.png'))])
 
6
    return b''
 
7
 
 
8
def serve_logo(e, sr):
 
9
    sr('200 OK', [('Content-Type', 'image/png')])
 
10
    return uwsgi.sendfile('logo_uWSGI.png')
 
11
 
 
12
def serve_options(e, sr):
 
13
    sr('200 OK', [('Content-Type', 'text/html')])
 
14
    for opt in range(0,256):
 
15
        body = "{opt} = {optvalue}<br/>".format(opt=opt, optvalue=uwsgi.get_option(opt))
 
16
        yield bytes(body.encode('ascii'))
 
17
 
 
18
def serve_config(e, sr):
 
19
    sr('200 OK', [('Content-Type', 'text/html')])
 
20
    for opt in uwsgi.opt.keys():
 
21
        body = "{opt} = {optvalue}<br/>".format(opt=opt, optvalue=uwsgi.opt[opt].decode('ascii'))
 
22
        yield bytes(body.encode('ascii'))
 
23
 
 
24
routes = {}
 
25
routes['/xsendfile'] = xsendfile
 
26
routes['/logo'] = serve_logo
 
27
routes['/config'] = serve_config
 
28
routes['/options'] = serve_options
 
29
 
 
30
def application(env, start_response):
 
31
 
 
32
    if env['PATH_INFO'] in routes:
 
33
        return routes[env['PATH_INFO']](env, start_response)
 
34
 
 
35
    start_response('200 OK', [('Content-Type', 'text/html')])
 
36
 
 
37
    body = """
 
38
<img src="/logo"/> version {version}<br/>
 
39
<hr size="1"/>
 
40
 
 
41
Configuration<br/>
 
42
<iframe src="/config"></iframe><br/>
 
43
 
 
44
<br/>
 
45
 
 
46
Dynamic options<br/>
 
47
<iframe src="/options"></iframe><br/>
 
48
 
 
49
    """.format(version=uwsgi.version.decode('ascii'))
 
50
 
 
51
    return bytes(body.encode('ascii'))
 
52
 
 
53
 
 
54
 
 
55
 
 
56
 
 
57