Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#13055 closed (fixed)

Transaction decorators / multiple databases : using=

Reported by: olb@… Owned by: nobody
Component: Database layer (models, ORM) Version: dev
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

Description

Documentation tells transaction decorators can be used with multiple databases :

    @commit_on_success(using='db_alias')
    def func(request):
        ...

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

    @commit_on_success('db_alias')
    def func(request):
        ...

Change History (5)

comment:1 by Karen Tracey, 14 years ago

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 by James Bennett, 14 years ago

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 by Russell Keith-Magee, 14 years ago

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 by Russell Keith-Magee, 14 years ago

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 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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