Remy Blank wrote:
> [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
>   

Ha, I had *exactly* the same thought... but then I tried to implement 
it, and it doesn't seem to be possible, as you must return a callable 
which takes the to-be-decorated function as input, and that callable 
won't get called until the decorated function is called...

But I'd be pleased to be proved wrong, as this would make things nicer.

-- Christian


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" 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/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to