@Wichert:

> Where do you see that in Pyramid?

here:

http://docs.pylonsproject.org/projects/pyramid/1.0/tutorials/wiki2/basiclayout.html#content-models-with-models-py
(code row #29)

is that a "not so good" practice? Where can I find a "good" one
example?

In my last (and only) Pylons app I always used session.commit and
others by myself and I think I never fell in troubles... at least I
hope...

@Eric:

I saw Akhet package but since I'm starting this new project from
scratch I'm not scared of using Pyramid as intended to and not as a
Pylons surrogate, no matter if I have to start over.

When you say abou Akhet:

> It gives a consistent way to structure Pyramid applications that works well
for Pylons users

do you mean Pyramid templates like "pyramid_routesalchemy"  lack some
kind of structure I should care to?

I apologize for the late answer I thought I set email notifications on
my discussion but I didn't...

Thanks for your support
neurino


On 18 Mag, 17:12, Wichert Akkerman <wich...@wiggy.net> wrote:
> On 5/18/11 14:28 , neurino wrote:
>
> > 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?
>
> There is no difference. DBSession.query is exactly the same as
> DBSession().query. If you want to know the details I would recommend to
> read the  SQLAlchemy documentation.
>
>
>
> > Moreover, what are the differences from Pyramid
>
> > import transaction
> > ...
> > model = MyModel(name=u'root', value=55)
> > session.add(model)
> > session.flush()
> > transaction.commit()
>
> Where do you see that in Pyramid? I would never recommend using
> transactions like that. Common practice is to use repoze.tm2 or
> something similar to manage your transactions at a higher layer.
>
> Wichert.

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

Reply via email to