Opened 6 years ago

Closed 6 years ago

Last modified 5 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: UI/UX:


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 6 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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 6 years ago by ubernostrum

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 6 years ago by russellm

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 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 5 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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