changeset 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 4de86feae6ac
files ChangeLog getan.py
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 30 22:21:47 2010 +0200
+++ b/ChangeLog	Tue Aug 31 19:25:23 2010 +0200
@@ -1,3 +1,9 @@
+2010-08-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  ISSUE1566
+
+	* getan.py: Bugfix: removed 'with' statement, replaced by try/finally.
+
 2010-08-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* getan.py: Added __enter__ and __exit__ methods. The exit method is used to
--- 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__':
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)