Hi,

I'm putting together a little demo using Pyramid with a MongoDB back end 
and routes-type url dispatch.

The pyramid_mongodb scaffold and all the example code I've seen attach the 
Mongo connection to each request, and the view_callable in turn passes it 
to the model. However, the SQLAlchemy scaffold uses a module-level Session 
object which gets an engine bound to it at startup, so functions that query 
the db do not need to receive a db connection explicitly. So, which is the 
more Pyramidal way to do it?

That's assuming that a module level Mongo connection will work 
satisfactorily.  According to the discussion at 
https://groups.google.com/forum/?fromgroups#!topic/pylons-discuss/6bLGOXngVvY 
it 
will, and my current toy implementation works that way; but I have seen 
some observations that it may cause problems with authenticated Mongo 
connections. I'll confess right now that my understanding of thread-local 
db connections is sketchy.

I can see an explicit-vs-implicit argument in favor of associating a db 
connection with each request; vs a Law of Demeter argument in favor of 
keeping any knowledge of requests out of models, and knowledge of db 
sessions out of views.

Any advice appreciated. And in case I am revisiting a long-settled 
discussion, apologies and thanks in advance for a link.


Wade Leftwich
Ithaca, NY



-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to