@@ -63,7 +63,7 @@ class DBUtilsExample(ExamplePage):
6363 if dbapi_name != 'pg' :
6464 config ['creator' ] = dbapi
6565 dbclass = getattr (dbmod , dbmod_name )(** config )
66- except dbapi .Error , error :
66+ except dbapi .Error as error :
6767 dbstatus = str (error )
6868 except Exception :
6969 dbstatus = 'Could not connect to the database.'
@@ -107,7 +107,7 @@ def output(self, s):
107107
108108 def outputMsg (self , msg , error = False ):
109109 self ._output .append ('<p style="color:%s">%s</p>'
110- % (error and 'red' or 'green' , msg ))
110+ % ('red' if error else 'green' , msg ))
111111
112112 def connection (self , shareable = True ):
113113 if self .dbstatus :
@@ -118,7 +118,7 @@ def connection(self, shareable=True):
118118 return self .dbclass .connection (shareable )
119119 else :
120120 return self .dbclass .connection ()
121- except self .dbapi .Error , error :
121+ except self .dbapi .Error as error :
122122 error = str (error )
123123 except Exception :
124124 error = 'Cannot connect to the database.'
@@ -288,7 +288,7 @@ def listAttendees(self):
288288 '<tr><th>Name</th><th>Seminar</th><th>Paid</th>'
289289 '<th>%s</th></tr>' % button )
290290 for name , id , title , paid in result :
291- paid = paid and 'Yes' or 'No'
291+ paid = 'Yes' if paid else 'No'
292292 id = id .ljust (4 ) + name
293293 wr ('<tr><td>%s</td><td>%s</td><td>%s</td>'
294294 '<td><input type="checkbox" name="id" value="%s"></td>'
0 commit comments