comparison 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
comparison
equal deleted inserted replaced
30:fea63a224065 31:fa5b3b1db867
138 self.backend.insert_project_entry(project, datetime.now(), desc) 138 self.backend.insert_project_entry(project, datetime.now(), desc)
139 self.update_entries(project) 139 self.update_entries(project)
140 self.update_project_list() 140 self.update_project_list()
141 logger.debug('Still running projects: %r' % self.running) 141 logger.debug('Still running projects: %r' % self.running)
142 142
143 def __enter__(self): 143 def shutdown(self):
144 return self
145
146 def __exit__(self, type, value, traceback):
147 for project in self.running: 144 for project in self.running:
148 self.stop_project() 145 self.stop_project()
149 146
150 147
151 def main(): 148 def main():
157 logging.info("Use database '%s'." % sys.argv[1]) 154 logging.info("Use database '%s'." % sys.argv[1])
158 else: 155 else:
159 backend = Backend() 156 backend = Backend()
160 logging.info("Use database '%s'." % DEFAULT_DATABASE) 157 logging.info("Use database '%s'." % DEFAULT_DATABASE)
161 158
162 with GetanController(backend, ProjectList, EntryList) as controller: 159 controller = GetanController(backend, ProjectList, EntryList)
160
161 try:
163 controller.main() 162 controller.main()
163 finally:
164 controller.shutdown()
164 165
165 166
166 if __name__ == '__main__': 167 if __name__ == '__main__':
167 main() 168 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)