Updated WSGI scripts.

This commit is contained in:
Kasper D. Fischer 2017-12-03 11:23:41 +00:00
parent aed22c7567
commit 87af90f047
Notes: subgit 2018-03-07 17:59:13 +01:00
r872 www/trunk
3 changed files with 31 additions and 7 deletions

1
.gitattributes vendored
View File

@ -1,5 +1,6 @@
* text=auto !eol * text=auto !eol
scripts/mkEvents.csh -text scripts/mkEvents.csh -text
wsgi/showEnv.py -text
www/.htaccess -text www/.htaccess -text
www/copyright.inc.de -text www/copyright.inc.de -text
www/external/TileLayer.Grayscale.js -text www/external/TileLayer.Grayscale.js -text

View File

@ -133,7 +133,7 @@ def fancy_plot(st, wsgi=False, img_format='png', color=True):
def trace_dayplot(st, deltat = None, def trace_dayplot(st, deltat = None,
ftype='bandpass', fmin=1.0, fmax=7.0, ftype='none', fmin=1.0, fmax=7.0,
col=('b', 'r', 'g'), interval=20, outpattern='', col=('b', 'r', 'g'), interval=20, outpattern='',
wsgi=False): wsgi=False):
""" """
@ -260,18 +260,24 @@ def main(backend=None, args=None, wsgi=False):
if args['stime']: if args['stime']:
otime = UTCDateTime(args['stime']) otime = UTCDateTime(args['stime'])
else: else:
otime = UTCDateTime() - 3600 - deltat otime = UTCDateTime() - 3600. - deltat
network = args['station'].split('.')[0] network = args['station'].split('.')[0]
station = args['station'].split('.')[1] station = args['station'].split('.')[1]
if args['type'] == 'dayplot': if args['type'] == 'dayplot':
if network == 'Z3':
channel = 'HHZ'
else:
channel = 'BHZ' channel = 'BHZ'
else: else:
if args['length'] < 3600: if args['length'] < 3600.:
channel = 'HH?'
else:
if network == 'Z3':
channel = 'HH?' channel = 'HH?'
else: else:
channel = 'BH?' channel = 'BH?'
else: else:
otime = UTCDateTime('2014-11-15T11:35:25Z') otime = UTCDateTime() - 3600.
deltat = 30 deltat = 30
network = 'GR' network = 'GR'
station = 'BUG' station = 'BUG'

17
wsgi/showEnv.py Normal file
View File

@ -0,0 +1,17 @@
def application(environ, start_response):
"""
Function application - Wrapper to process wsgi request
:param environ: contains information on the wsgi environment
:type environ: dict
:param start_response: function to process response header by the wsgi server
:type start_response: function
:return: response to be sent to the client by the wsgi server
:rtype: list
"""
from cgi import FieldStorage
form = FieldStorage(fp=environ['wsgi.input'], environ=environ)
start_response('200 OK', [('Content-Type', 'text/html')])
return [form]