#13055 closed (fixed)
Transaction decorators / multiple databases : using=
Reported by: | 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 , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 15 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 , 15 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 , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
autocommit
,commit_on_success
, andcommit_manually
all have their one kwarg specified asfunc_or_using
, notusing
as per the doc.