On Jan 24, 10:40 pm, Michael Merickel <[email protected]> wrote:
> http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/narr/com...
>
> Not sure what else to say here.. your use case is why p.paster.bootstrap
> exists.

I had no idea it exists.  It's exactly what I needed.  I missed the
changelog on this 2 years ago!


    from pyramid.paster import bootstrap
    from pyramid.request import Request

    import myapp
    import myapp.lib.handlers
    import myapp.models.core

    class BootstrappedHandler( myapp.lib.handlers._CoreHandler ) :
        def __init__( self , request ):
            self.request = request
            self._setupDbWriter()

    env = bootstrap('MyApp/development.ini')

    bootstrapped = BootstrappedHandler( env['request'] )
    print bootstrapped
    print bootstrapped.request.dbSession.writer

    print
bootstrapped.request.dbSession.writer.query( myapp.models.core.Useraccount 
).all()


    env['closer']()

-- 
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].
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to