|
From: | Sebastian Spaeth |
Subject: | [GMG-Devel] cyclic imports |
Date: | Fri, 14 Dec 2012 12:34:39 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10 |
I want to give better error message in the case of csrf failures. To do so I modify
GMG.meddlewares.csrf to return a GMG.tools.response:render_error(). 1) tools.response imports tools.template to get access to render_template() 2) tools.template imports meddlewares.csrf to get access to render_csrf_token(). 3) meddlewares.csrf imports tools.response to get access to render_error() 4) BANG BOOM CRASH. ImportError!How can we solve this issues in this specific and the general case? Here I could imagine to solve/fix this by splitting CSRF into a meddlewares.csrf (which does the checking) and a tools.csrf (which does the actual rendering of the token). But that would split CSRF functionality over 2 files. (we could also put it into tools.template rather than tools.csrf).
Sebastian
[Prev in Thread] | Current Thread | [Next in Thread] |