As a Pylons user I'm trying to switch to Pyramid now trying to
understand differences.

In Pylons I was used to define Session in myproj.model.meta as:

Session = scoped_session(sessionmaker())
then import it in myproj.model to define model and so on then in app
refer to:

root = Session.query(MyModel).filter(...)...
now using a default template in Pyramid (pyramid_routesalchemy) I
define Session as before (except calling it DBSession and adding an
extension):

DBSession =
scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
but in views.py I don't use it directly but instantiate it:

dbsession = DBSession()
root = dbsession.query(MyModel).filter(...)...
Why? What are the differences?

Moreover, what are the differences from Pyramid

import transaction
...
model = MyModel(name=u'root', value=55)
session.add(model)
session.flush()
transaction.commit()
to Pylons

model = MyModel(name=u'root', value=55)
session.add(model)
session.commit()

Thank you for your support

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" 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-devel?hl=en.

Reply via email to