@@ -106,11 +106,11 @@ def postAction(self, actionName):
106106 def output (self , s ):
107107 self ._output .append (s )
108108
109- def outputMsg (self , msg , error = 0 ):
109+ def outputMsg (self , msg , error = False ):
110110 self ._output .append ('<p style="color:%s">%s</p>'
111111 % (error and 'red' or 'green' , msg ))
112112
113- def connection (self , shareable = 1 ):
113+ def connection (self , shareable = True ):
114114 if self .dbstatus :
115115 error = self .dbstatus
116116 else :
@@ -123,7 +123,7 @@ def connection(self, shareable=1):
123123 error = str (error )
124124 except Exception :
125125 error = 'Cannot connect to the database.'
126- self .outputMsg (error , 1 )
126+ self .outputMsg (error , True )
127127
128128 def sqlEncode (self , s ):
129129 if s is None :
@@ -132,7 +132,7 @@ def sqlEncode(self, s):
132132 return "'%s'" % s
133133
134134 def createTables (self ):
135- db = self .connection (0 )
135+ db = self .connection (False )
136136 if not db :
137137 return
138138 for table in tables :
@@ -148,7 +148,7 @@ def createTables(self):
148148 except self .dbapi .Error , error :
149149 if self .dbapi_name != 'pg' :
150150 db .rollback ()
151- self .outputMsg (error , 1 )
151+ self .outputMsg (error , True )
152152 else :
153153 self .outputMsg ('The table was successfully created.' )
154154 db .close ()
@@ -160,7 +160,7 @@ def listSeminars(self):
160160 id = [id ]
161161 cmd = ',' .join (map (self .sqlEncode , id ))
162162 cmd = 'delete from seminars where id in (%s)' % cmd
163- db = self .connection (0 )
163+ db = self .connection (False )
164164 if not db :
165165 return
166166 try :
@@ -179,7 +179,7 @@ def listSeminars(self):
179179 db .rollback ()
180180 except Exception :
181181 pass
182- self .outputMsg (error , 1 )
182+ self .outputMsg (error , True )
183183 return
184184 else :
185185 self .outputMsg ('Entries deleted: %d' % len (id ))
@@ -197,10 +197,10 @@ def listSeminars(self):
197197 result = cursor .fetchall ()
198198 cursor .close ()
199199 except self .dbapi .Error , error :
200- self .outputMsg (error , 1 )
200+ self .outputMsg (error , True )
201201 return
202202 if not result :
203- self .outputMsg ('There are no seminars in the database.' , 1 )
203+ self .outputMsg ('There are no seminars in the database.' , True )
204204 return
205205 wr = self .output
206206 button = self ._buttons [1 ].replace ('List seminars' , 'Delete' )
@@ -236,7 +236,7 @@ def listAttendees(self):
236236 for i , n in places .items ():
237237 cmds .append ("update seminars set places_left=places_left+%d "
238238 "where id=%s" % (n , self .sqlEncode (i )))
239- db = self .connection (0 )
239+ db = self .connection (False )
240240 if not db :
241241 return
242242 try :
@@ -254,7 +254,7 @@ def listAttendees(self):
254254 db .query ('end' )
255255 else :
256256 db .rollback ()
257- self .outputMsg (error , 1 )
257+ self .outputMsg (error , True )
258258 return
259259 else :
260260 self .outputMsg ('Entries deleted: %d' % len (id ))
@@ -274,10 +274,10 @@ def listAttendees(self):
274274 result = cursor .fetchall ()
275275 cursor .close ()
276276 except self .dbapi .Error , error :
277- self .outputMsg (error , 1 )
277+ self .outputMsg (error , True )
278278 return
279279 if not result :
280- self .outputMsg ('There are no attendees in the database.' , 1 )
280+ self .outputMsg ('There are no attendees in the database.' , True )
281281 return
282282 wr = self .output
283283 button = self ._buttons [2 ].replace ('List attendees' , 'Delete' )
@@ -338,7 +338,7 @@ def newSeminar(self):
338338 db .query ('end' )
339339 else :
340340 db .rollback ()
341- self .outputMsg (error , 1 )
341+ self .outputMsg (error , True )
342342 else :
343343 self .outputMsg ('"%s" added to seminars.' % values [1 ])
344344 db .close ()
@@ -358,7 +358,7 @@ def newAttendee(self):
358358 result = cursor .fetchall ()
359359 cursor .close ()
360360 except self .dbapi .Error , error :
361- self .outputMsg (error , 1 )
361+ self .outputMsg (error , True )
362362 return
363363 if not result :
364364 self .outputMsg ('You have to define seminars first.' )
@@ -425,7 +425,7 @@ def newAttendee(self):
425425 db .query ('end' )
426426 else :
427427 db .rollback ()
428- self .outputMsg (error , 1 )
428+ self .outputMsg (error , True )
429429 else :
430430 self .outputMsg ('%s added to attendees.' % values [0 ])
431431 db .close ()
0 commit comments