durusmail: qp: Re: Fwd: qp Sudoku - a Session demo
Re: Fwd: qp Sudoku - a Session demo
2006-04-27
2006-04-28
Re: Fwd: qp Sudoku - a Session demo
David Binger
2006-04-28
On Apr 27, 2006, at 6:13 PM, Tristan Short wrote:

> Is there anything else you would do differently/better, not that
> there is much to this app?

I would try break up that giant method into smaller parts somehow.
If possible, I  would use a qp.fill.form.Form somehow to
handle submits.  In our applications, we almost never access
the request fields directly.
More comments below.

> Also is there a qp site for qp addons and recipes similar to this?

Not yet, but I think there will be before long.


These are odd methods.
I'm guessing you had to do this to force the session to be saved,
even for non-authenticated users

Maybe your session class needs something like this?

     def needs_saving(self):
         if _p_oid:
             return False
         return True

This will, however, save a session for everyone, so web crawlers that
don't deliver cookies will still cause your session mapping to
grow rapidlly.  Real applications that want saved sessions
for anonymous users should have some kind of protection
against this.

>     def start_session(self):
>         sess = get_session()
>         user = User('anonymous')
>         sess.set_authenticated(user)
>         redirect('.')
>
>
>     def end_session [html] (self):
>         resp = get_response()
>         sess = get_session()    # just being clean. Not necessary
> to do clear_authentication()
>         sess.clear_authentication()
>         resp.expire_cookie(get_site().get_name())
>         redirect('.')

reply