From a8a90cf4148b8d480a4a6dde296882faa852d756 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 4 Apr 2020 16:33:52 +0200 Subject: [PATCH] morss: move url/options parsing to own function For future re-use --- morss/morss.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/morss/morss.py b/morss/morss.py index 51e37ec..9f15235 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -508,8 +508,9 @@ def process(url, cache=None, options=None): return FeedFormat(rss, options) -def cgi_app(environ, start_response): +def cgi_parse_environ(environ): # get options + if 'REQUEST_URI' in environ: url = environ['REQUEST_URI'][1:] else: @@ -535,11 +536,18 @@ def cgi_app(environ, start_response): # init options = Options(filterOptions(parseOptions(raw_options))) - headers = {} global DEBUG DEBUG = options.debug + return (url, options) + + +def cgi_app(environ, start_response): + url, options = cgi_parse_environ(environ) + + headers = {} + # headers headers['status'] = '200 OK' headers['cache-control'] = 'max-age=%s' % DELAY