witten
/
luminotes
Archived
1
0
Fork 0

"Fix" for occasional "ProgrammingError: no results to fetch" from rows = self.cursor.fetchall() in PostgreSQL session filter.

This commit is contained in:
Dan Helfman 2008-10-29 15:09:45 -07:00
parent 60d8062ba7
commit ba7a9437d8
1 changed files with 8 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import cherrypy
from psycopg2 import ProgrammingError
from cherrypy.filters.sessionfilter import PostgreSQLStorage
@ -12,6 +13,13 @@ class Session_storage( PostgreSQLStorage ):
self.db = cherrypy.root.database.get_connection()
self.cursor = self.db.cursor()
def load( self, *args, **kwargs ):
try:
PostgreSQLStorage.load( self, *args, **kwargs )
# catch "ProgrammingError: no results to fetch" from self.cursor.fetchall()
except ProgrammingError:
return None
def save( self, *args, **kwargs ):
PostgreSQLStorage.save( self, *args, **kwargs )
self.db.commit()