Another approach, without doing too many changes:

In middleware.py, right before it initializes the main session from config:

    session2_opts = {
        'session.type': 'cookie',
        'session.key': 'sess2',
        'session.cookie_expires': True,
        'session.auto': True,
        'session.domain': config['session.domain'],
        'session.secure': False,
    }
app = SessionMiddleware(app, environ_key='beaker.session2', config = session2_opts)
    app = SessionMiddleware(app, config)

And then access this session object using:
    s2 = environ['beaker.session2']
    s2['param'] = val
    ....

You can create the new session directly in middleware. It does not read the config file (but can be made to do so pretty easily).

DD.

DD wrote:
I have the same problem (need 2 different sessions).

It seems that one approach to do this will be to write a SessionManager, similar to CacheManager and then modify the SessionMiddleware to use it instead of directly using the Session object. My knowledge on this is limited, but if someone can outline what's the best way to do this, I can definitely take a shot it.

DD

Michael Naber wrote:
What is the right way to go about creating more than one Beaker
session? I see the need to do this because I would like to have one
session that is secure (cookie over ssl only) and another one that is
not secure.

Thanks,
Michael

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

Reply via email to