changeset 47:0a0c77b8606a project-tree

#1921 Bugfix: Moving entries into projects with keys that consist of more than a single char works again.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 15 Feb 2011 21:10:19 +0100
parents 780bfda9c583
children d2cc754b4dcd
files ChangeLog getan/states.py
diffstat 2 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Dec 21 19:34:03 2010 +0100
+++ b/ChangeLog	Tue Feb 15 21:10:19 2011 +0100
@@ -1,3 +1,8 @@
+2011-02-15  Ingo Weinzierl <ingo@intevation.de>
+
+	* getan/states.py: Bugfix: We are able to move entries into projects with
+	  a key that consist of more than one single char again.
+
 2010-12-21  Ingo Weinzierl <ingo@intevation.de>
 
 	* getan.py: Added a method to sort the projects based on its key.
--- a/getan/states.py	Tue Dec 21 19:34:03 2010 +0100
+++ b/getan/states.py	Tue Feb 15 21:10:19 2011 +0100
@@ -401,11 +401,13 @@
 
 class MoveEntryState(EntryListState):
     messages = {
-        'project': _(" Into which project do you want to move these entries?"),
+        'project': _(" Into which project do you want to move these entries?" \
+                     " (> %s)"),
         'really':  _(" Are you sure? (> %s) (y/n)"),
     }
 
-    proj = None
+    proj   = None
+    theKey = ""
 
     def __init__(self, state, controller, view):
         super(MoveEntryState, self).__init__(state, controller, view)
@@ -431,11 +433,24 @@
             return DefaultEntryListState(self.projectlist_state,
                                          self.controller, self.view)
 
+        if 'backspace' in key:
+            if len(self.theKey) > 0:
+                self.theKey = self.theKey[0:len(self.theKey)-1]
+                self.view.set_footer_text(self.msg('project') % self.theKey,
+                                          'question')
+            return self
+
         if len(key) > 0 and self.proj is None:
-            self.proj = self.controller.project_by_key(key[0])
-            if self.proj:
+            self.theKey += key[0]
+            proj = self.controller.project_by_key(self.theKey)
+            if not proj or proj.children:
+                self.view.set_footer_text(self.msg('project') % self.theKey,
+                                          'question')
+                return self
+            if proj and not proj.children:
+                self.proj = proj
                 logger.debug("MoveEntryState: prepared entries to be moved to "\
                              "project '%s'" % self.proj.desc)
-                self.view.set_footer_text(self.msg('really'), 'question')
+                self.view.set_footer_text(self.msg('really') % self.proj.desc, 'question')
 
         return self
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)