changeset 42:a5439795ef09

More checks againts empty projects.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 15 Dec 2010 12:02:55 +0100
parents f44f808e7d47
children 39d845d3fec4
files getan.py getan/states.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/getan.py	Wed Dec 15 11:55:25 2010 +0100
+++ b/getan.py	Wed Dec 15 12:02:55 2010 +0100
@@ -54,7 +54,9 @@
 
     def update_entries(self, project):
         logger.debug("GetanController: update entries.")
-        self.entries_view.set_rows(self.backend.load_entries(project.id))
+        if project: entries = self.backend.load_entries(project.id)
+        else:       entries = []
+        self.entries_view.set_rows(entries)
         self.view.update_view()
 
     def move_selected_entries(self, project):
@@ -131,6 +133,7 @@
         logger.debug('All running projects: %r' % self.running)
 
     def stop_project(self, desc='-no description-'):
+        if not self.running: return
         project = self.running.pop()
         if not project: return
         logger.info("Stop project '%s' at %s."
--- a/getan/states.py	Wed Dec 15 11:55:25 2010 +0100
+++ b/getan/states.py	Wed Dec 15 12:02:55 2010 +0100
@@ -193,7 +193,7 @@
         self.view.select()
         if self.break_start:
             proj = self.view.item_in_focus()
-            proj.start += datetime.now() - self.break_start
+            if proj: proj.start += datetime.now() - self.break_start
         self.controller.view.set_footer_text(self.msg('description'),'question',1)
         self.controller.view.get_frame().set_focus('footer')
         return DescriptionProjectsState(
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)