Sean Cazzell, el martes 15 de noviembre a las 17:09 me escribiste:
>
> There has been a lot of interest on the list of having a way to
> automatically wrap a request in a transaction. The most obvious way to
> do this is to add it into expose. Michele has done a great job putting
> together the relevant information (with suggestions from Ian Bicking) on
> ticket #80 here:
>
> http://trac.turbogears.org/turbogears/ticket/80
>
> Since I am already doing some hacking on expose (moving the validator
> and inputform functionality out to separate decorators) I thought I'd
> pick this one up.
>
> My question is - do we want this on by default, or do we want to
> explicitly enable it with a parameter to expose?
>
> Enabled by default (must explicitly disable):
> @expose(transaction=False)
>
> Disabled by default (must explicitly enable):
> @expose(transaction=True)
>
> Obviously the latter is backwards compatible, but if everyone is going
> to want a transaction for all of their controller methods, maybe it
> should be enabled by default?
What about a different decorator? I don't think is a good idea to keep
adding complexity to expose. And the transaction is not orthogonal to
exposure, you can have no-exposed event wrapped in a transaction an vice
versa.
So you can have:
@expose(template='something')
@transaction
def list():
# ...
or
@transaction
def save(something):
# ...
Better name accepted =)
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
.------------------------------------------------------------------------,
\ GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05 /
'--------------------------------------------------------------------'
Hey you, standing in the road
always doing what you're told,
Can you help me?