changeset 33:f96a18c10836

Made getan python-2.4 compatible.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 31 Aug 2010 19:37:37 +0200
parents 4de86feae6ac
children a9f2e8fd8970
files ChangeLog getan.py getan/backend.py
diffstat 3 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 31 19:27:36 2010 +0200
+++ b/ChangeLog	Tue Aug 31 19:37:37 2010 +0200
@@ -1,3 +1,7 @@
+2010-08-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* getan.py, getan/backend.py: Made getan Python-2.4 compatible.
+
 2010-08-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* contrib/wochenbericht: Added a parameter 'year' that makes possible to
--- a/getan.py	Tue Aug 31 19:27:36 2010 +0200
+++ b/getan.py	Tue Aug 31 19:37:37 2010 +0200
@@ -58,7 +58,7 @@
         old_project = None
         entries = []
         try:
-            while True:
+            while self.entries_view.selection:
                 node = self.entries_view.selection.pop()
                 if node.selected: node.select()
                 entries.append(node.item)
@@ -69,8 +69,6 @@
 
                 if not old_project:
                     old_project = self.project_by_id(node.item.project_id)
-        except IndexError, err:
-            pass
         finally:
             self.backend.move_entries(entries, project.id)
             if not old_project: return
@@ -84,7 +82,7 @@
         proj    = None
         entries = []
         try:
-            while True:
+            while self.entries_view.selection:
                 node = self.entries_view.selection.pop()
                 if node.selected: node.select()
                 entries.append(node.item)
@@ -95,8 +93,6 @@
 
                 if proj is None:
                     proj = self.project_by_id(node.item.project_id)
-        except IndexError, err:
-            pass
         finally:
             self.backend.delete_entries(entries)
             proj.entries = self.backend.load_entries(proj.id)
--- a/getan/backend.py	Tue Aug 31 19:27:36 2010 +0200
+++ b/getan/backend.py	Tue Aug 31 19:37:37 2010 +0200
@@ -9,7 +9,10 @@
 #
 
 import logging
-import sqlite3 as db
+try:
+    import sqlite3 as db
+except ImportError:
+    from pysqlite2 import dbapi2 as db
 
 from getan.project import Project, Entry
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)