Stores don't rollback correctly in Django
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Storm |
New
|
Undecided
|
Unassigned |
Bug Description
When using storm as a Django db backend, if you have to rollback a store due to a database disconnection, the connection isn't set up again properly. Here's a short example using Django's interactive shell:
$ python manage.py shell
Python 2.6.4 (r264:75706, Nov 2 2009, 14:38:03)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveCon
>>> # My STORM_STORES is {'data': 'postgres:
>>> from django.db import connection
>>> cur = connection.cursor()
>>> # Before continuing, restart the database so that the connection is stale
>>> cur.execute('select true')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "(...)/
return self.cursor.
OperationalError: terminating connection due to administrator command
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
>>> # As expected, that failed. So let's rollback...
>>> connection.
>>> cur = connection.cursor()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "(...)/
cursor = self._cursor(
File "(...)/
cursor = super(StormData
File "(...)/
self.connection = Database.
OperationalError: FATAL: database "data" does not exist
At this point it shouldn't be trying to connect in line 84 of django/
Or am I doing it wrong? :)
Looks like StormDatabaseWr apperMixin. _get_connection () should include a call to self._store. _connection. _ensure_ connected( ).