I've implemented session support for Tornado. You can find the commit
here http://github.com/milancermak/tornado/commit/5cf388672cdd492c3f76fd96aad5b3526ece0789
(I'm new to Git and GitHub, I hope everyone can access it).
The commit provides file and MySQL based sessions. Every request
handler has a session object, which behaves as a python dictionary;
plus, it has a couple utility functions available. For additional
info, check out the in-code docs.
It is in no way complete. The biggest issue in my opinion is, that the
developer has to explicitly save the session if the data changes. I
believe this could be resolved quite easily by adding a couple of
lines to the code.
Please let me know what you think, any critique is welcomed.
Milan
Sent from my iPhone
On Jan 25, 2010, at 4:55 PM, Milan Cermak <milan....@gmail.com>
wrote:
On Jan 26, 9:53 am, Matt Ferguson <mbf...@gmail.com> wrote:
> This is nice, especially for those of us who believe that solutions
> such as Beaker are a little too heavy to justify. I will fork this
> and try to improve it a little, and add support for more backend
> solutions (memcached, redis, etc as it's my personal belief that MySQL
> is a little heavy for use with sessions)
>
> Sent from my iPhone
>
> On Jan 25, 2010, at 4:55 PM, Milan Cermak <milan.cer...@gmail.com>
> wrote:
>
> > Hi,
>
> > I've implemented session support for Tornado. You can find the commit
> > herehttp://github.com/milancermak/tornado/commit/5cf388672cdd492c3f76fd96...
On Jan 26, 10:10 am, wataka <nhy...@googlemail.com> wrote:
> Nice. If you have a stub, I might try getting the MongoDb backend done
>
> On Jan 26, 9:53 am, Matt Ferguson <mbf...@gmail.com> wrote:
>
> > This is nice, especially for those of us who believe that solutions
> > such as Beaker are a little too heavy to justify. I will fork this
> > and try to improve it a little, and add support for more backend
> > solutions (memcached, redis, etc as it's my personal belief that MySQL
> > is a little heavy for use with sessions)
>
Cool. I have similar believes; my plan is to provide at least
Memcached storage. Redis and Mongo would be great. Plus, I was
persuaded that a file based storage, where every session is stored in
a separate file is also a valid approach so I want to support it too.
I will commit couple of small improvements later this evening, mostly
regarding the MySQLSession class.
So if you want session + tornado framework and GAE, it's very easy to
convert from webapp to tornado.
Regards.
http://gaeutilities.appspot.com/ provides a session class that uses
memcache and the backend datastore together. It also supports cookie
only sessions, and includes a rotating token system to provide more
security for sessions, especially in instances where you can't use ssl
(ssl is only available for .appspot.com domains, not your own).
Gaeutilities also has several other utility classes, such as a cache,
and a Retry and Timeout model to provide more stability for your
application on top of the appengine datastore. It also is written in
such a way as you should easily be able to plug it in to tornado no
problem.
from appengine_utilities import session
my_session = session.Session()
my_session[key] = value
The one caveat is that I've moved away from appengine for development
of my primary application, so while I do still provide patches for
issues when they are brought up, I'm also looking for someone
qualified to take over the project.
http://github.com/joerussbowman/tornado-mc-sessions
On Jan 26, 10:13 am, Matthew Ferguson <mbf...@gmail.com> wrote:
> MongoDB is my database of choice, it'd be very simple to plug that into Tornado for sessions code.
>
> On Jan 26, 2010, at 1:10 AM, wataka wrote:
>
> > Nice. If you have a stub, I might try getting the MongoDb backend done
>
> > On Jan 26, 9:53 am, Matt Ferguson <mbf...@gmail.com> wrote:
> >> This is nice, especially for those of us who believe that solutions
> >> such as Beaker are a little too heavy to justify. I will fork this
> >> and try to improve it a little, and add support for more backend
> >> solutions (memcached, redis, etc as it's my personal belief that MySQL
> >> is a little heavy for use with sessions)
>
> >> Sent from my iPhone
>
> >> On Jan 25, 2010, at 4:55 PM, Milan Cermak <milan.cer...@gmail.com>
> >> wrote:
>
> >>> Hi,
>
> >>> I've implementedsessionsupport for Tornado. You can find the commit
> >>> herehttp://github.com/milancermak/tornado/commit/5cf388672cdd492c3f76fd96...
> >>> (I'm new to Git and GitHub, I hope everyone can access it).
>
> >>> The commit provides file and MySQL based sessions. Every request
> >>> handler has asessionobject, which behaves as a python dictionary;
> >>> plus, it has a couple utility functions available. For additional
> >>> info, check out the in-code docs.
>
> >>> It is in no way complete. The biggest issue in my opinion is, that the
> >>> developer has to explicitly save thesessionif the data changes. I