comparison getan.py @ 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
parents 99639833968d
children a23e8191c6bc
comparison
equal deleted inserted replaced
98:7c3f43bfc0a8 99:4912568f9048
83 old_project.entries = self.backend.load_entries(old_project.id) 83 old_project.entries = self.backend.load_entries(old_project.id)
84 self.update_entries(old_project) 84 self.update_entries(old_project)
85 self.project_view.update_all() 85 self.project_view.update_all()
86 86
87 def delete_entries(self, entry_nodes): 87 def delete_entries(self, entry_nodes):
88 if not entry_nodes: return 88 if not entry_nodes:
89 proj = None 89 return
90 entries = [] 90 proj = self.project_by_id(entry_nodes[0].project_id)
91 try: 91 entries = entry_nodes
92 while self.entries_view.selection: 92 self.backend.delete_entries(entries)
93 node = self.entries_view.selection.pop() 93 proj.entries = self.backend.load_entries(proj.id)
94 if node.selected: node.select() 94 self.update_entries(proj)
95 entries.append(node.item) 95 self.project_view.update()
96 logger.info("GetanController: delete entry '%s' (id = %d, "\
97 "project id = %d)"
98 % (node.item.desc, node.item.id,
99 node.item.project_id))
100
101 if proj is None:
102 proj = self.project_by_id(node.item.project_id)
103 finally:
104 self.backend.delete_entries(entries)
105 proj.entries = self.backend.load_entries(proj.id)
106 self.update_entries(proj)
107 self.project_view.update()
108 96
109 def update_project_list(self): 97 def update_project_list(self):
110 self.project_view.update() 98 self.project_view.update()
111 self.view.update_view() 99 self.view.update_view()
112 100
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)