On Mon, Jan 3, 2011 at 4:14 PM, Francesco Mazzoli <[email protected]> wrote:
> I am using fancyupload ( http://digitarald.de/project/fancyupload/ )
> to have a nice queued multiple upload.
>
> It works perfectly, but there is a problem. When flash makes the
> request, the cookie information is lost, and thus the session is lost.
> I can attach the session id as a GET parameter, but then I don't
> really know how to load it.manually.
> I tried with all the functions listed on this page:
> http://beaker.groovie.org/modules/session.html , but I couldn't figure
> it out.
>
> Any suggestions?

It was a TG2 application so I don't know if it might help you, but we
were able to solve the problem by passing the cookie as an argument to
the upload method and then fetching the authenticated user
corresponding to the cookie with the following code:

 if kw.has_key('authtkt'):
            from paste.auth import auth_tkt

            #repoze.who is configure to do not use the remote address
            remote_addr = '0.0.0.0'
            #repoze.cookie secret is defined in config/app_cfg.py
            cookie_secret = "you_cookie_secret"

            try:
                timestamp, userid, tokens, user_data =
auth_tkt.parse_ticket(cookie_secret, kw.get('authtkt'), remote_addr)
                user = DBSession.query(User).filter_by(user_name=userid).one()
            except:
                user = None

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to