On Thu, Mar 10, 2011 at 01:07:32PM -0800, Seth wrote:
Are those of us not returning real Response objects stuck with building
our cookie strings manually, or am I missing something here?
I think you should be able to use a sacrificial WebOb Response object
to construct the cookies for you.
Going through the trouble of creating a webob response is much more
complicated than simply adding a response_callback.
def _set_cookie(request, response):
response.set_cookie()
request.add_response_callback(_set_cookie)
Michael
--
You received this message because you are
On Sat, Mar 12, 2011 at 01:55:21PM -0600, Michael Merickel wrote:
Going through the trouble of creating a webob response is much more
complicated than simply adding a response_callback.
def _set_cookie(request, response):
response.set_cookie()
I'm having the hardest time figuring out the best way to set cookies for my
methods that don't return a true Response object (and therefore, don't
have a set_cookie() method). Is there no such helper in the Pyramid stack?
The closest thing I've found so far is the Varying Attributes of Rendered
To me, the answer to this question really lies in what session
implementation are you using?
For me, I've opted to use a session in a database on the server, which
allows me to set arbitrarily large items into the session without any real
penalty.
Then, for whatever you'd set a custom cookie
Currently I'm using the default cookie/session factories, but I'm looking to
actually set cookies that last longer than the session so the
request.session solution doesn't apply (unless I'm missing something
there--I don't think it can be given a max_age). The callback method you
suggested