Andrew,

Thank you very much for your offer of help. I have managed to solve the 
problem after spending a day(almost). The problem is a result of multiple 
conditions coming together to cause failures in the following way. 

The web.py framework depends upon default value of atime being set by Mysql 
and hence not all the database calls that create or update session variable 
have atime as field, update call has it but insert does not. 
python2.7/site-packages/web/session.py has this code: 
        self.db.insert(self.table, False, session_id=key, data=pickled )
whereas update has this:
        self.db.update(self.table, where="session_id=$key", atime=now, 
vars=locals())

I use Mysql 5.5 which does not support default value for atime on datetime 
field but supports for timestamp field. The instructions for web.py are for 
5.6 and above(apparently) and hence I could not set default value for atime 
and ignored the instructions. 

I added all this to github and proposed a fix as well. 
https://github.com/webpy/webpy/issues/323
and made a fix as :
https://github.com/webpy/webpy/commit/dcc6173c5d882a5242007ed36e4fe862e8390243
and pull request as :
https://github.com/webpy/webpy/pull/324

As to why things worked in some cases is still a mystery to me but I don't 
have time to solve that one as I have a fix now.

Suhas

On Sunday, March 8, 2015 at 10:22:44 AM UTC+5:30, Suhas Patil wrote:
>
> I am testing my web.py application using automated tests and the 
> application is running on Apache.  The automated tests always fail when the 
> Apache is restarted but succeed when the tests are rerun even though 
> nothing has changed in the code or the system. The tests assume no previous 
> state of the system meaning they are designed to be run on a freshly 
> installed software.
>
> When I investigated, I noticed that the session value in the database is 
> overwritten by subsequent calls to the server. In other words, if I run 
> following command in sequence then the first five or six times I only find 
> one value stored in the database. Only subsequent calls to curl then start 
> creating a new session entry in the table. 
>        $ curl -v  http://www.example.com/foo
>
> As a result if my tests because I want to use webpy_session_id for taking 
> the application through different code paths.
>
>       $ curl -v --cookie 
> 'webpy_session_id=49e10d40f342ee92c30eea76e0804af28718a63f;' 
> http://www.example.com/foo
>
> I tried going through session.py module but I could not debug it on the 
> server and didn't want to spend too much time on it. Does anybody have a 
> solution for this? 
>
> Thanks
>
> Suhas.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to