Code

Opened 5 years ago

Closed 5 years ago

#10487 closed (fixed)

Refactor database-backend-selection logic into a function

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

Description

There's a bunch of logic in django/db/__init__.py that loads the appropriate backend from django.db.backends based on the DATABASE_ENGINE setting. We should put this logic into a function so it can be used by other code.

The specific use-case is multiple-database code that needs to load a separate backend for each database connection.

See discussion in this django-developers thread, starting with Yuri Baburov's comment.

Attachments (2)

conn.diff (3.7 KB) - added by Alex 5 years ago.
conn.2.diff (3.7 KB) - added by Alex 5 years ago.
make the patch useful, I am an idiot

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by Alex

Changed 5 years ago by Alex

make the patch useful, I am an idiot

comment:1 Changed 5 years ago by adrian

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

(In [10045]) Fixed #10487 -- Refactored the database-backend-selection logic into a function, django.db.load_backend. Thanks to Alex Gaynor for the initial patch

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.