Mercurial > getan
changeset 240:78967e4218bd
Refactor controller move_selected_entries method to use move_entries
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 09 Apr 2013 20:41:59 +0200 |
parents | cc24919789be |
children | 024f3de92b2a |
files | getan/controller.py |
diffstat | 1 files changed, 10 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/controller.py Tue Apr 09 20:41:28 2013 +0200 +++ b/getan/controller.py Tue Apr 09 20:41:59 2013 +0200 @@ -87,29 +87,17 @@ self.project_view.update_rows() def move_selected_entries(self, project): - old_project = 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: move entry '%s' (id = %d, "\ - "project id = %d) to project '%s'" - % (node.item.desc, node.item.id, - node.item.project_id, project.desc)) - - if not old_project: - old_project = self.project_by_id(node.item.project_id) - finally: - self.backend.move_entries(entries, project.id) - if not old_project: - return - project.entries = self.backend.load_entries(project.id) - old_project.entries = self.backend.load_entries(old_project.id) - self.update_entries(old_project) - self.project_view.update_all() + while self.entries_view.selection: + node = self.entries_view.selection.pop() + if node.selected: + node.select() + entries.append(node.item) + logger.info("GetanController: move entry '%s' (id = %d, "\ + "project id = %d) to project '%s'" + % (node.item.desc, node.item.id, + node.item.project_id, project.desc)) + self.move_entries(entries, project) def delete_entries(self, entry_nodes): if not entry_nodes: