Changeset 3321

Show
Ignore:
Timestamp:
02/02/08 16:30:50 (16 years ago)
Author:
jerome
Message:

Added some code to close the database if needed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/utils.py

    r3318 r3321  
    153153                            % locals())) 
    154154        retcode = -1 
     155    application = None     
    155156    try : 
    156         application = workclass() 
    157         application.deferredInit() 
    158         retcode = application.main(arguments, options) 
    159     except KeyboardInterrupt :         
    160         logerr("\nInterrupted with Ctrl+C !\n") 
    161         retcode = -3 
    162     except PyKotaCommandLineError, msg :     
    163         logerr("%s : %s\n" % (sys.argv[0], msg)) 
    164         retcode = -2 
    165     except SystemExit :         
    166         pass 
    167     except : 
    168         title = _("%(appname)s failed") % locals() 
    169157        try : 
    170             application.crashed(title) 
     158            application = workclass() 
     159            application.deferredInit() 
     160            retcode = application.main(arguments, options) 
     161        except KeyboardInterrupt :         
     162            logerr("\nInterrupted with Ctrl+C !\n") 
     163            retcode = -3 
     164        except PyKotaCommandLineError, msg :     
     165            logerr("%s : %s\n" % (sys.argv[0], msg)) 
     166            retcode = -2 
     167        except SystemExit :         
     168            pass 
     169        except : 
     170            title = _("%(appname)s failed") % locals() 
     171            try : 
     172                application.crashed(title) 
     173            except :     
     174                crashed(title) 
     175            retcode = -1 
     176    finally :     
     177        try : 
     178            application.storage.close() 
    171179        except :     
    172             crashed(title) 
    173         retcode = -1 
    174          
     180            pass 
     181             
    175182    sys.exit(retcode)