One approach is to create a wrapper that inspects a request and chooses a
session implementation. The session factory can be any callable that takes
a request object and returns a session object, so if I understood correctly
that's the hook you're looking for.

You'd likely want something along the lines of:

def MySessionFactoryWrapper(**settings_from_ini):
    # create the two types of session factories you need
    server_session = beaker_session_from_settings(**settings_from_ini)
    other_session = other_session_from_settings(**settings_from_ini)

    # create a function that can inspect the request and return the correct
session type
    def session_from_request(request):
        if some_criteria:
            return server_session(request)
        else:
            return other_session(request)

    return session_from_request


Then in your main __init__ you'd have:

    my_session_factory = MySessionFactoryWrapper(**settings)
    config.set_session_factory(my_session_factory)

The end result is each time pyramid needs a session it would pass in a
request and get back a session object based on some_criteria. There are
many variations on that theme but hopefully that's enough to go on. Let me
know if you need more details.






On Tue, Jun 18, 2013 at 10:47 AM, Jonathan Vanasco <[email protected]>wrote:

> We have an app that deploys over multiple domains
>
> DomainA is the "root" application and used for authentication , etc. It
> contains HTTP & HTTPS server-side sessions. Data is proxied to other
> domains via an iFrame lookup.
>
> DomainB - DomainZ are "child" applications. We'd like to drop the
> server-side sessions off them; they could either have NoSession or a
> client-side session.
>
> I'm trying to figure out if any of this is doable; we're using
> pyramid_beaker and don't have an issue forking it -- but this doesn't
> really look possible using the Session Interface for pyramid itself. it
> doesn't look like i'd be able to interface with a request object where i
> need it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to