From 1f4c219880e435769fccd3ea3a95a4291a717ea2 Mon Sep 17 00:00:00 2001 From: pictuga Date: Tue, 25 Jun 2013 13:13:23 +0200 Subject: [PATCH] Common code for url/options handling --- morss.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/morss.py b/morss.py index e6b5e0d..a1e98b9 100644 --- a/morss.py +++ b/morss.py @@ -457,27 +457,26 @@ def Gather(url, cachePath, mode='feed'): return root.tostring(xml_declaration=True, encoding='UTF-8') if __name__ == "__main__": - if 'REQUEST_URI' in os.environ: - url, options = parseOptions(OPTIONS) + url, options = parseOptions(OPTIONS) + if 'REQUEST_URI' in os.environ: print 'Status: 200' if options == 'progress': - print 'Content-Type: application/octet-stream\n' + print 'Content-Type: application/octet-stream' else: - print 'Content-Type: text/html\n' + print 'Content-Type: text/html' + print cache = os.getcwd() + '/cache' log(url) else: - url, options = parseOptions(OPTIONS) - - if url is None: - print "Please provide url." - sys.exit(1) - cache = os.path.expanduser('~') + '/.cache/morss' + if url is None: + print "Please provide url." + sys.exit(1) + if options == 'progress': MAX_TIME = -1 if options == 'cache':