librelist archives

« back to archive

Easy Access To Session ID + Wait Page?

Easy Access To Session ID + Wait Page?

From:
Date:
2011-05-23 @ 18:39
I'm really enjoying Flask and have started to use sessions.  I now
find myself in need of a unique session identifier.  I can create one,
but was wondering if there's an easily accessible one in the existing
system (not wanting to add beaker or explicitly do another system
using werkzeug)?

Also, is there an easy way to do a 'Please Wait' page with Flask?
From a form post, I'm invoking an external process that can take a
while, but from the Python routine that does it, I can't figure out
how to either write HTML directly or (much better) signal Flask to do
it before returning with the populated results template.

Thanks in advance,
Jeff

Re: [flask] Easy Access To Session ID + Wait Page?

From:
Ron DuPlain
Date:
2011-05-23 @ 18:55
On Mon, May 23, 2011 at 2:39 PM,  <jmkatcher@gmail.com> wrote:
> I'm really enjoying Flask and have started to use sessions.  I now
> find myself in need of a unique session identifier.  I can create one,
> but was wondering if there's an easily accessible one in the existing
> system (not wanting to add beaker or explicitly do another system
> using werkzeug)?

Not sure what your requirements are, but you can always create UUIDs:

    import uuid
    uuid.uuid4()


> Also, is there an easy way to do a 'Please Wait' page with Flask?
> >From a form post, I'm invoking an external process that can take a
> while, but from the Python routine that does it, I can't figure out
> how to either write HTML directly or (much better) signal Flask to do
> it before returning with the populated results template.

Celery task queues might be what you want:
http://celeryproject.org/

I you want to do the work in the view function, I'd recommend an ajax
call; show the progress dialog via JavaScript.

-Ron