Mercurial > getan
diff getan.py @ 31:fa5b3b1db867
Bugfix: removed 'with' statement - replaced by try/finally (ISSUE1566).
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 31 Aug 2010 19:25:23 +0200 |
parents | fea63a224065 |
children | f96a18c10836 |
line wrap: on
line diff
--- a/getan.py Mon Aug 30 22:21:47 2010 +0200 +++ b/getan.py Tue Aug 31 19:25:23 2010 +0200 @@ -140,10 +140,7 @@ self.update_project_list() logger.debug('Still running projects: %r' % self.running) - def __enter__(self): - return self - - def __exit__(self, type, value, traceback): + def shutdown(self): for project in self.running: self.stop_project() @@ -159,8 +156,12 @@ backend = Backend() logging.info("Use database '%s'." % DEFAULT_DATABASE) - with GetanController(backend, ProjectList, EntryList) as controller: + controller = GetanController(backend, ProjectList, EntryList) + + try: controller.main() + finally: + controller.shutdown() if __name__ == '__main__':