librelist archives

« back to archive

Subclassing request to add cache headers

Subclassing request to add cache headers

From:
Tim Golden
Date:
2010-11-26 @ 15:14
I want to add etag/last-modified/if-modified-since functionality
to my requests / responses. It looks to me as though the thing to
do is to subclass the Flask class and to set the .request_class and
.response_class attributes to suitably-altered subclasses of
Request & Response. Am I on the right track? Or have I missed something
obvious? I note that Werkzeug has a couple of useful mixins which
would get me halfway there...

An alternative seems to be a view decorator, which I might also consider.
Grateful for any advice / experience.

TJG