@@ -121,7 +121,7 @@ def do_import(self):
121121
122122 file_names = os .listdir (self .import_dir )
123123 if len (file_names ) != 1 :
124- logger .critical ("Cannot find a root directory in %s." %
124+ logger .critical ("Cannot find a root directory in %s." ,
125125 self .import_source )
126126 archive .cleanup ()
127127 return False
@@ -136,8 +136,8 @@ def do_import(self):
136136 "and recreating the database." ,
137137 exc_info = True )
138138 return False
139- except Exception as error :
140- logger .critical ("Unable to access DB.\n %r" % error )
139+ except Exception :
140+ logger .critical ("Unable to access DB." , exc_info = True )
141141 return False
142142
143143 with SessionGen () as session :
@@ -168,8 +168,8 @@ def do_import(self):
168168 "version %d). It may take a while to adapt it to "
169169 "the current data model (which is version %d). You "
170170 "can use cmsDumpUpdater to update the on-disk dump "
171- "and speed up future imports."
172- % ( dump_version , model_version ) )
171+ "and speed up future imports." ,
172+ dump_version , model_version )
173173
174174 if dump_version > model_version :
175175 logger .critical (
@@ -179,7 +179,7 @@ def do_import(self):
179179 "way to adapt it to the current data model (which "
180180 "is version %d). You probably need to update CMS to "
181181 "handle it. It is impossible to proceed with the "
182- "importation." % ( dump_version , model_version ) )
182+ "importation." , dump_version , model_version )
183183 return False
184184
185185 for version in range (dump_version , model_version ):
@@ -279,7 +279,7 @@ def do_import(self):
279279 if not self .safe_put_file (file_ , desc ):
280280 logger .critical ("Unable to put file `%s' in the DB. "
281281 "Aborting. Please remove the contest "
282- "from the database." % file_ )
282+ "from the database." , file_ )
283283 # TODO: remove contest from the database.
284284 return False
285285
@@ -288,7 +288,7 @@ def do_import(self):
288288 archive .cleanup ()
289289
290290 if contest_id is not None :
291- logger .info ("Import finished (contest id: %s)." %
291+ logger .info ("Import finished (contest id: %s)." ,
292292 ", " .join ("%d" % id_ for id_ in contest_id ))
293293 else :
294294 logger .info ("Import finished." )
@@ -413,14 +413,14 @@ def safe_put_file(self, path, descr_path):
413413 digest = self .file_cacher .put_file_from_path (path , description )
414414 except Exception as error :
415415 logger .critical ("File %s could not be put to file server (%r), "
416- "aborting." % ( path , error ) )
416+ "aborting." , path , error )
417417 return False
418418
419419 # Then check the digest.
420420 calc_digest = sha1sum (path )
421421 if digest != calc_digest :
422422 logger .critical ("File %s has hash %s, but the server returned %s, "
423- "aborting." % ( path , calc_digest , digest ) )
423+ "aborting." , path , calc_digest , digest )
424424 return False
425425
426426 return True
0 commit comments