On the same topic, I am wondering if anyone has tried to plug in/adapt
the already existing
InteractivePageHandler and InteractiveExecuteHandler as they don't
really seem to need any session management at all.
If anybody tried it and it didn't work out please let me know before I
spend too much time on it :-).

tia,

./alex

On Nov 8, 5:47 am, Alex Popescu <[EMAIL PROTECTED]>
wrote:
> I'm really sorry if it sounded that way, so please do not take it this
> way.
>
> I have made some changes according to my above comments and it looks
> like it is working as expected. Now I am not really sure the changes
> are perfectly 'pythonic' (as I'm no expert), but here is what I've
> done:
>
> FrontPageHandler:
>
>   def get(self):
>     if not users.get_current_user():
>       return self.error(403)
>     # set up the session. TODO: garbage collect old shell sessions
>     session_key = self.request.get('session')
>     if session_key:
>       session = Session.get(session_key)
>     if not session_key or not session:
>       # create a new session
>       session = Session()
>       session.unpicklables = [db.Text(line) for line in
> INITIAL_UNPICKLABLES]
>       session_key = session.put()
>       self.redirect(ROOT_PATH + '/shell?session=%s' % session_key)
>
>   # rest is identical
>
>    def post(self):
>     user = users.get_current_user()
>     if not user:
>       return self.error(403)
>     session_key = self.request.get('session')
>     if session_key:
>       Session.get(session_key).delete()
>     self.redirect(users.create_logout_url(ROOT_PATH + '/shell'))
>
> and plugged the post method to the Logout action. Indeed the post
> method should check if the session object actually exists before
> attempting to delete it.
>
> I'm opened to all comments, opinions and ideas.
>
> ./alex
> On Nov 8, 5:33 am, yejun <[EMAIL PROTECTED]> wrote:
>
> > Your expectation on a sample is a little bit too high.
>
> > On Nov 7, 9:59 pm, Alex Popescu <[EMAIL PROTECTED]>
> > wrote:
>
> > > I was looking at Shell, the Featured app available here [1] and I have
> > > a couple of questions related to its 'Session' management.
>
> > > 1. I think that the FrontPageHandler should redirect to the URL
> > > containing the newly created 'Session' session key, otherwise any page
> > > refresh would lead to a new 'Session'
>
> > > 2. it looks like the Sessions are persisted forever in the storage and
> > > there is no way to clean them out (automatically). It looks like the
> > > only way to do it is to run at the end of your 'scripting' session a
> > > db.delete(Session.all().fetch(10)). Maybe there should be a 'Logout'
> > > button that also takes care of this clean up.
>
> > > Thanks in advance for your comments,
>
> > > ./alex
>
> > > [1]http://code.google.com/p/google-app-engine-samples/downloads/list
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to