From e5fc9786f62746c9e529a00449f216fe16891574 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 9 Nov 2013 18:43:16 +0100 Subject: [PATCH] Set urlPath var earlier --- morss.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/morss.py b/morss.py index 8cf6b1a..87c5113 100644 --- a/morss.py +++ b/morss.py @@ -525,14 +525,20 @@ if __name__ == '__main__': if 'REQUEST_URI' in os.environ: HOLD = True - if 'HTTP_IF_NONE_MATCH' in os.environ and not options.force: - if time.time() - int(os.environ['HTTP_IF_NONE_MATCH'][1:-1]) < DELAY: + if 'HTTP_IF_NONE_MATCH' in os.environ: + if not options.force and time.time() - int(os.environ['HTTP_IF_NONE_MATCH'][1:-1]) < DELAY: print 'Status: 304' print log(url) log('etag good') sys.exit(0) + cachePath = os.getcwd() + '/cache' + + else: + cachePath = os.path.expanduser('~') + '/.cache/morss' + + if 'REQUEST_URI' in os.environ: print 'Status: 200' print 'ETag: "%s"' % int(time.time()) @@ -548,10 +554,6 @@ if __name__ == '__main__': HOLD = False - cachePath = os.getcwd() + '/cache' - else: - cachePath = os.path.expanduser('~') + '/.cache/morss' - if url is None: print 'Please provide url.' sys.exit(1)