Opened 14 years ago

Closed 13 years ago

#13630 closed Bug (fixed)

DatabaseOperations doesn't have same constructor with SQLITE and PostgreSQL backend

Reported by: Cédric RICARD Owned by: nobody
Component: Database layer (models, ORM) Version: 1.2
Severity: Normal Keywords:
Cc: ian.g.kelly@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using sqlite3 backend on Django 1.2.1, the DatabaseOperations object is constructed without any parameter (no change from older versions).
Example:

from django.db import backend

backend.DatabaseOperations().quote_name(my_value)

But using postgresql_psycopg2 backend, the DatabaseOperations constructor need a connection as parameter :
Example:

from django.db import backend, connection

backend.DatabaseOperations(connection).quote_name(my_value)

So this is not possible to have a code working with all backends.

Attachments (1)

13630.diff (9.9 KB ) - added by Ramiro Morales 13 years ago.
Patch for this issue, includes a test

Download all attachments as: .zip

Change History (7)

comment:1 by Tobias McNulty, 14 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by Ramiro Morales, 13 years ago

Triage Stage: Design decision neededAccepted

Actually, both PosgreSQL backends are the only ones accepting the connection parameter in their __init__ methods, Oracle, MySQL suffer from the same issue as reported by this ticket. We have an inconsistency here.

comment:3 by Erin Kelly, 13 years ago

Cc: ian.g.kelly@… added

comment:4 by Julien Phalip, 13 years ago

Severity: Normal
Type: Bug

by Ramiro Morales, 13 years ago

Attachment: 13630.diff added

Patch for this issue, includes a test

comment:5 by Ramiro Morales, 13 years ago

Has patch: set

comment:6 by Ramiro Morales, 13 years ago

Resolution: fixed
Status: newclosed

In [16016]:

Fixed #13630 -- Made init methods of all DB backends' DatabaseOperations classes take a connection argument. Thanks calexium for the report.

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