summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2015-03-12 13:51:04 -0400
committerSimo Sorce <simo@redhat.com>2015-03-12 14:48:11 -0400
commit078942b2cf6d73697f4c6b8a28cabe940f358532 (patch)
tree66dcb178eb814e41800abb60d28593bb02dc28dc
parenta1bcbfd426a6c3860edf53e12da32ff6daad4442 (diff)
downloadipsilon-078942b2cf6d73697f4c6b8a28cabe940f358532.tar.gz
ipsilon-078942b2cf6d73697f4c6b8a28cabe940f358532.tar.xz
ipsilon-078942b2cf6d73697f4c6b8a28cabe940f358532.zip
Proper fallback from referer to REQUEST_URI
If the referer is present but does not contain a transaction ID we still need to fallback to the REQUEST_URI. Fix the code to check the url and then fallback to REQUEST_URI rathe than decide upfront merely on the fact a referer is available. https://fedorahosted.org/ipsilon/ticket/74 Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Nathan Kinder <nkinder@redhat.com>
-rw-r--r--ipsilon/util/page.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ipsilon/util/page.py b/ipsilon/util/page.py
index 50585ca..7e88534 100644
--- a/ipsilon/util/page.py
+++ b/ipsilon/util/page.py
@@ -143,9 +143,11 @@ class Page(Endpoint):
url = None
if 'referer' in cherrypy.request.headers:
url = cherrypy.request.headers['referer']
- elif 'REQUEST_URI' in cherrypy.request.wsgi_environ:
+ r = urlparse(unquote(url))
+ if r.query:
+ tid = t.find_tid(parse_qs(r.query))
+ if not tid and 'REQUEST_URI' in cherrypy.request.wsgi_environ:
url = cherrypy.request.wsgi_environ['REQUEST_URI']
- if url:
r = urlparse(unquote(url))
if r.query:
tid = t.find_tid(parse_qs(r.query))