Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#13055 closed (fixed)

Transaction decorators / multiple databases : using=

Reported by: olb@… Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords: transaction decorators
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Documentation tells transaction decorators can be used with multiple databases :

    def func(request):

Doing like that raises an error and it seems that django code is actually written to work as follow :

    def func(request):

Change History (5)

comment:1 Changed 9 years ago by Karen Tracey

Triage Stage: UnreviewedAccepted

autocommit, commit_on_success, and commit_manually all have their one kwarg specified as func_or_using, not using as per the doc.

comment:2 Changed 9 years ago by James Bennett

Is there a reason why it's not just using everywhere (since all the other transaction-management functions take it as using)? We don't provide any documentation for passing a function there or explaining why you'd want to do that, and from the code I can't figure out what that feature's useful for...

comment:3 Changed 9 years ago by Russell Keith-Magee

This is an example of internal implementation leaking to the external API. The argument is called 'func_or_using' because @transaction and @transaction('my_alias') are both allowed forms. The first case is required for backwards compatibility, and it's that case where you are providing a function.

Practicality should trump the purity of internal variable naming; we should change the argument to 'using', and document the weirdness internally.

comment:4 Changed 9 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [12752]) Fixed #13055 -- Cleaned up the implementation of transaction decorators to provide a consistent external facing API. Thanks to olb@… for the report.

comment:5 Changed 7 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top