changeset 99:4912568f9048

Refactor delete_entries to do what it says: delete the entries passed as argument The provided entries weren't used to delete the entries from the database. A better method name would have been delete_selected_entries().
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 12 Sep 2011 13:57:58 +0200 (2011-09-12)
parents 7c3f43bfc0a8
children 8f433e3c2f21
files getan.py
diffstat 1 files changed, 8 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/getan.py	Mon Sep 12 13:32:15 2011 +0200
+++ b/getan.py	Mon Sep 12 13:57:58 2011 +0200
@@ -85,26 +85,14 @@
             self.project_view.update_all()
 
     def delete_entries(self, entry_nodes):
-        if not entry_nodes: return
-        proj    = None
-        entries = []
-        try:
-            while self.entries_view.selection:
-                node = self.entries_view.selection.pop()
-                if node.selected: node.select()
-                entries.append(node.item)
-                logger.info("GetanController: delete entry '%s' (id = %d, "\
-                            "project id = %d)"
-                            % (node.item.desc, node.item.id,
-                               node.item.project_id))
-
-                if proj is None:
-                    proj = self.project_by_id(node.item.project_id)
-        finally:
-            self.backend.delete_entries(entries)
-            proj.entries = self.backend.load_entries(proj.id)
-            self.update_entries(proj)
-            self.project_view.update()
+        if not entry_nodes:
+            return
+        proj    = self.project_by_id(entry_nodes[0].project_id)
+        entries = entry_nodes
+        self.backend.delete_entries(entries)
+        proj.entries = self.backend.load_entries(proj.id)
+        self.update_entries(proj)
+        self.project_view.update()
 
     def update_project_list(self):
         self.project_view.update()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)