Commits

Simone Marzola committed ee6cff5

redirect to host_url when the vote request has the referer header empty

Comments (0)

Files changed (1)

tgcomments/controllers/root.py

 def back_to_referer(*args, **kw):
     if not kw.get('success'):
         flash('Failed to post comment', 'error')
-    raise redirect(request.referer)
+    if request.referer is not None:
+        raise redirect(request.referer)
+    raise redirect(request.host_url)
 
 class RootController(TGController):
     @expose()