[Twisted-web] web2 response.setCookie and request.getCookie
shortcuts?
Andrea Arcangeli
andrea at cpushare.com
Fri Jan 20 22:05:50 MST 2006
On Thu, Nov 17, 2005 at 03:55:37PM -0500, Clark C. Evans wrote:
> So, this is what I mean by per-request state. Since each stage of
> execution happens by a distinct Resource, a great deal of information
> needs to be stored in the Request object (or what ever you want to call
> it). Now if a ClarkRequest extends a HttpRequest to add what I need,
> so be it; right now my code is sloppy -- I just modify the request
> object's dict. Perhaps it is poor pratice; but with a decent regression
> test it really isn't a problem at all. I only have a handful of
> variables that are needed.
I'm also clobbering the req dict namespace for similar reasons:
def start_timer(self, req):
req.start_time = time.time()
def render(self, req):
self.start_timer(req)
and I'm also doing session authentication by hand with the cookie + db,
so I plan to clobber more of the req for the session. Using interfaces
would avoid the clobbering but it's slower.
And what was the final decision about getCookie/setCookie? If they're
added I can change my code to them too ;).
Thanks.
More information about the Twisted-web
mailing list