comparison roundup/backends/back_postgresql.py @ 4421:67bef70ab9b9

- more logger fixes, sorry for the noise.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Fri, 17 Sep 2010 06:47:58 +0000
parents 9655a1b65974
children 4f353d71d716
comparison
equal deleted inserted replaced
4420:9655a1b65974 4421:67bef70ab9b9
40 db_command(config, command) 40 db_command(config, command)
41 41
42 def db_nuke(config, fail_ok=0): 42 def db_nuke(config, fail_ok=0):
43 """Clear all database contents and drop database itself""" 43 """Clear all database contents and drop database itself"""
44 command = 'DROP DATABASE %s'% config.RDBMS_NAME 44 command = 'DROP DATABASE %s'% config.RDBMS_NAME
45 logging.getLogger('hyperdb').info(command) 45 logging.getLogger('roundup.hyperdb').info(command)
46 db_command(config, command) 46 db_command(config, command)
47 47
48 if os.path.exists(config.DATABASE): 48 if os.path.exists(config.DATABASE):
49 shutil.rmtree(config.DATABASE) 49 shutil.rmtree(config.DATABASE)
50 50
129 def getSessionManager(self): 129 def getSessionManager(self):
130 return Sessions(self) 130 return Sessions(self)
131 131
132 def sql_open_connection(self): 132 def sql_open_connection(self):
133 db = connection_dict(self.config, 'database') 133 db = connection_dict(self.config, 'database')
134 logging.getLogger('hyperdb').info('open database %r'%db['database']) 134 logging.getLogger('roundup.hyperdb').info(
135 'open database %r'%db['database'])
135 try: 136 try:
136 conn = psycopg.connect(**db) 137 conn = psycopg.connect(**db)
137 except psycopg.OperationalError, message: 138 except psycopg.OperationalError, message:
138 raise hyperdb.DatabaseError(message) 139 raise hyperdb.DatabaseError(message)
139 140
216 return '<roundpsycopgsql 0x%x>' % id(self) 217 return '<roundpsycopgsql 0x%x>' % id(self)
217 218
218 def sql_commit(self, fail_ok=False): 219 def sql_commit(self, fail_ok=False):
219 ''' Actually commit to the database. 220 ''' Actually commit to the database.
220 ''' 221 '''
221 logging.getLogger('hyperdb').info('commit') 222 logging.getLogger('roundup.hyperdb').info('commit')
222 223
223 try: 224 try:
224 self.conn.commit() 225 self.conn.commit()
225 except psycopg.ProgrammingError, message: 226 except psycopg.ProgrammingError, message:
226 # we've been instructed that this commit is allowed to fail 227 # we've been instructed that this commit is allowed to fail
227 if fail_ok and str(message).endswith('could not serialize ' 228 if fail_ok and str(message).endswith('could not serialize '
228 'access due to concurrent update'): 229 'access due to concurrent update'):
229 logging.getLogger('hyperdb').info('commit FAILED, but fail_ok') 230 logging.getLogger('roundup.hyperdb').info(
231 'commit FAILED, but fail_ok')
230 else: 232 else:
231 raise 233 raise
232 234
233 # open a new cursor for subsequent work 235 # open a new cursor for subsequent work
234 self.cursor = self.conn.cursor() 236 self.cursor = self.conn.cursor()

Roundup Issue Tracker: http://roundup-tracker.org/