Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#15230 closed (fixed)

django.db.backends.dummy.base.DatabaseWrapper has no attribute 'transaction_state'

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


Steps to reproduce

  1. Start a new Django (r15438) project
  2. Add a URL mapping to a view that does not exist
  3. Start the development server
  4. Access the URL


Traceback (most recent call last):

  File "/tmp/django/core/servers/", line 282, in run
    self.result = application(self.environ, self.start_response)

  File "/tmp/django/contrib/staticfiles/", line 68, in __call__
    return self.application(environ, start_response)

  File "/tmp/django/core/handlers/", line 273, in __call__
    response = self.get_response(request)

  File "/tmp/django/core/handlers/", line 168, in get_response
    receivers = signals.got_request_exception.send(sender=self.__class__, request=request)

  File "/tmp/django/dispatch/", line 172, in send
    response = receiver(signal=self, sender=sender, **named)

  File "/tmp/django/db/", line 100, in _rollback_on_exception

  File "/tmp/django/db/", line 182, in rollback_unless_managed
    if not is_managed(using=using):

  File "/tmp/django/db/", line 137, in is_managed
    if connection.transaction_state:

AttributeError: 'DatabaseWrapper' object has no attribute 'transaction_state'


Index: db/backends/dummy/
--- db/backends/dummy/	(revision 15438)
+++ db/backends/dummy/	(working copy)
@@ -52,5 +52,8 @@
         self.settings_dict = settings_dict
         self.alias = alias
+        self.transaction_state = []
     def close(self):


I checked django/db/backends/ and there are some other attributes that might be relevant.

This should be fixed for 1.3 as it renders Django unusable for Projects that do not need a database.

Change History (2)

comment:1 Changed 5 years ago by Alex

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

In [15440]:

Fixed #15230 -- added some more attributes to the dummy database backend.

comment:2 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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