Code

Opened 4 years ago

Closed 3 years ago

#14022 closed (worksforme)

context_processors debug() Fails with no DB Backend

Reported by: dvine Owned by: nobody
Component: Core (Other) Version: 1.2
Severity: Keywords: sprintdec2010
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If no database backend is defined the debug() function of djnago.core.context_processors fails at:

context_extras['sql_queries'] = connection.queries

because the 'DatabaseWrapper' object has no attribute 'queries'

This happens in my pip install of Django 1.2.1 on my Linux Server but not in my recent trunk checkout on my Windows djago dev server.

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by julien

  • Keywords sprintdec2010 added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

If you do not specify any DATABASE_XXXX settings then the connection is set to a django.db.backends.dummy.base.DatabaseWrapper instance, which does have a queries attribute (an empty list). Therefore no exception is raised in this context processor. For that reason (and after discussing this with russellm) I'm closing this as worksforme.

I do not doubt you're having an issue with this, but if you'd like it to be addressed you need to provide more information about how to reproduce it:

  • What do you mean by "the debug() function fails at"? What exception is raised?
  • What do you mean by "if no database backend is defined"? As I said, if you do not specify any database settings then it should just work. So what are you doing to disable (or not enable) the database backend in your project?

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.