[email protected] wrote:
>     Usage:
>      -- def api_method(p1, p2):
>      --     @as_transaction(env, db)
>      --     def implementation_method(p3, p4, db):
>      --         # implementation
>      --
>      --     implementation_method()

Why not run transaction() in the decorator directly in
transaction_creator, instead of returning it? Or rather, drop
transaction() and execute the code in transaction_creator(). This would
allow writing the following:

def api_method(p1, p2):
    @as_transaction(env, db)
    def implementation_method(db, p3, p4):
        # implementation

Maybe name the decorator "run_as_transaction" to make it clear that it
actually runs the decorated function.

-- Remy

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to