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
scripts/mkEvents.csh -text
wsgi/showEnv.py -text
www/.htaccess -text
www/copyright.inc.de -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,
ftype='bandpass', fmin=1.0, fmax=7.0,
ftype='none', fmin=1.0, fmax=7.0,
col=('b', 'r', 'g'), interval=20, outpattern='',
wsgi=False):
"""
@ -260,18 +260,24 @@ def main(backend=None, args=None, wsgi=False):
if args['stime']:
otime = UTCDateTime(args['stime'])
else:
otime = UTCDateTime() - 3600 - deltat
otime = UTCDateTime() - 3600. - deltat
network = args['station'].split('.')[0]
station = args['station'].split('.')[1]
if args['type'] == 'dayplot':
channel = 'BHZ'
if network == 'Z3':
channel = 'HHZ'
else:
channel = 'BHZ'
else:
if args['length'] < 3600:
if args['length'] < 3600.:
channel = 'HH?'
else:
channel = 'BH?'
if network == 'Z3':
channel = 'HH?'
else:
channel = 'BH?'
else:
otime = UTCDateTime('2014-11-15T11:35:25Z')
otime = UTCDateTime() - 3600.
deltat = 30
network = 'GR'
station = 'BUG'
@ -398,4 +404,4 @@ if __name__ == "__main__":
if os.getenv('DISPLAY'):
main(args=cla)
else:
main('Agg', cla)
main('Agg', cla)

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]