Opened 16 years ago

Closed 13 years ago

#8238 closed Uncategorized (fixed)

django/db/__init__.py assumes it is loaded from the filesystem

Reported by: Guido van Rossum <guido@…> Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: bhuztez@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There is code in the django.db package init.py that lists the available db backends. Unfortunately this code uses os.listdir() on a directory derived from file, and when loaded from a zip archive, this doesn't work. I have a quick hack that works around this, but perhaps there's a better way.

Attachments (2)

db.diff (1.0 KB ) - added by Guido van Rossum <guido@…> 16 years ago.
patch
load-backend-pep-302.diff (1.2 KB ) - added by bhuztez 13 years ago.
taken from pep-302.5.diff for #596

Download all attachments as: .zip

Change History (9)

by Guido van Rossum <guido@…>, 16 years ago

Attachment: db.diff added

patch

comment:1 by Malcolm Tredinnick, 16 years ago

milestone: 1.0
Triage Stage: UnreviewedAccepted

comment:2 by Guido van Rossum <guido@…>, 16 years ago

ping?

comment:3 by Malcolm Tredinnick, 16 years ago

The ticket is marked as 1.0. Not 1.0-beta. We addressed those first. It's still open. We'll get to it. :-)

comment:4 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [8424]) Fixed #8238 -- If an invalid database backend is mentioned in settings and the
environment doesn't support os.listdir(), we crashed whilst trying to construct
the friendly error message. This was not so friendly.

This patch handles that case (which occurs in real life in Google App Engine).
Patch from Guido van Rossum.

comment:5 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

by bhuztez, 13 years ago

Attachment: load-backend-pep-302.diff added

taken from pep-302.5.diff for #596

comment:6 by bhuztez, 13 years ago

Cc: bhuztez@… added
Easy pickings: unset
Resolution: fixed
Severity: Normal
Status: closedreopened
Type: Uncategorized
UI/UX: unset

The load-backend-pep-302 patch use pkgutil.iter_modules instead of os.listdir to solve this.

comment:7 by Ramiro Morales, 13 years ago

Resolution: fixed
Status: reopenedclosed

Thanks for the contribution. Please don't reopen closed for bugs reported and fixed a long time ago with the intention of proposing new features, even when the topics are tightly related. It pollutes ticket history and overall bug tracker stats (e.g. lifetime of tickets)

Open a new ticket for that.

Last edited 13 years ago by Ramiro Morales (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top