> If you have transactions off, then you can enable them for a particular
> method by passing transaction=True to expose, or you can use the
> in_transaction (name suggestions are welcome) decorator directly.
What if I want to factor out my DB logic (save a user, etc) into a "service
layer" (Fowler, PoEAA) because I want to expose a certain amount of my
functionality to xmlrpc or a web service? Then, there may be a need for
chaining the methods in this service layer. Using a decorator for my
transaction management, there should be a way to say if I need a new
transaction or e.g. an active transaction.
IMHO, the name "in_transaction" is then a bit imprecise.
Sean, what do you think about this naming styles:
new_transaction()
in_transaction()
-- OR --
transaction(new=True)
transaction(new=False) or transaction(participate=True)
If a database systems allows the use of nested transaction, these naming
styles would allow to use a decorator like
nested_transaction()
-- OR --
transaction(nested=True)
The second naming style is open for improvements and I think it is not less
readable:
@in_transaction()
def meth(self):
@transaction()
def meth(self):
By the way: TurboGears is a great piece of software! Thank all of you for
making this possible and sharing it.
Best regards,
Roman