Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#8706 closed (fixed)

Django lists *.pyo files as available database backends if you compiled Django in optimized mode

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

Description

One can compile the whole Django package as optimized .pyo files or use it from a script executed by python -OO, which turns on creation of .pyo file. There is a line in db/__init__.py that lists the available backends:

available_backends = [f for f in os.listdir(backend_dir) if not f.startswith('_') and not f.startswith('.') and not f.endswith('.py') and not f.endswith('.pyc')]

It lists util.pyo and creation.pyo as available backends. The list should be filtered to include only directories instead. For example:

available_backends = [f for f in os.listdir(backend_dir) if os.path.isdir(os.path.join(backend_dir, f)]

Change History (4)

comment:1 by Malcolm Tredinnick, 16 years ago

milestone: 1.0

Not 1.0 material. That list is only used for diagnostics; this can wait.

comment:2 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [9930]) Fixed #8706 -- Improved the way we detect available database backends.

Thanks, victor@….

comment:4 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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