Unable to set Django cookie and twill-session

I am testing a django application with twill and django-test-utils and it does not register me.

I think this is not a django session cookie setting. I go to a webpage (in twill) that calls request.session.set_test_cookie(), and after that call returns twill.show_cookies()(which should print cookies), does not show cookies. In another page / view request.session.test_cookie_worked()returns False.

Oddly enough, another page calls request.set_cookie(...)to manually set a cookie, and it works. twill.show_cookies()indicates cookie. So some cookies work, but session middleware just doesn't work ...

What could be? How to set django session cookie in twill?

Some other people had similar problems, example for django-users , cookie comment on another twill / django script

+3
source share
1 answer

As the FC said that if the client and server are different machines with different times (or even possibly time zones), you may run into problems with the expiration of cookies.

I just double checked the code forset_test_cookie() , and it looks like it sets this value pretty normal. Are you sure that the page you are encountering does not return an error (and therefore does not install test_cookie)? There are a number of ways that can happen, but from the head:

  • Twill Host,
  • Twill referer
  • Twill //multipart/something else
  • Twill - .

. , . . , .

0

All Articles