"Fix" for occasional "ProgrammingError: no results to fetch" from rows = self.cursor.fetchall() in PostgreSQL session filter.
This commit is contained in:
parent
60d8062ba7
commit
ba7a9437d8
|
@ -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()
|
||||
|
|
Reference in New Issue