[Thuban-commits] r2871 - in trunk/thuban: . Thuban Thuban/Model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 20 14:10:31 CET 2009


Author: dpinte
Date: 2009-03-20 14:10:25 +0100 (Fri, 20 Mar 2009)
New Revision: 2871

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Thuban/Model/transientdb.py
   trunk/thuban/Thuban/version.py
Log:
2009-03-20 Didrik Pinte <dpinte at dipole-consulting.com>

   * Thuban/Model/transient.db.py, Thuban/version.py : added support for sqlite3 module

Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2009-03-18 11:11:31 UTC (rev 2870)
+++ trunk/thuban/ChangeLog	2009-03-20 13:10:25 UTC (rev 2871)
@@ -1,3 +1,7 @@
+2009-03-20 Didrik Pinte <dpinte at dipole-consulting.com>
+
+   * Thuban/Model/transient.db.py, Thuban/version.py : added support for sqlite3 module
+
 2009-03-18 Didrik Pinte <dpinte at dipole-consulting.com>
 
    * Thuban/UI/view.py, viewport.py  : support mouse double click events

Modified: trunk/thuban/Thuban/Model/transientdb.py
===================================================================
--- trunk/thuban/Thuban/Model/transientdb.py	2009-03-18 11:11:31 UTC (rev 2870)
+++ trunk/thuban/Thuban/Model/transientdb.py	2009-03-20 13:10:25 UTC (rev 2871)
@@ -24,15 +24,20 @@
 # and named.
 # The sqlite2 boolean variable is used to manage specific part of the code
 try:
-      # Using SQLITE 2.x
+
+    # Using SQLITE 3.x
+    import sqlite3 as sqlite
     sqlite2 = True
-    from pysqlite2 import dbapi2 as sqlite
 except ImportError:
-      # Using SQLITE 1.x
-    sqlite2 = False
-    import sqlite
+    try :
+        # Using SQLITE 2.x
+        sqlite2 = True
+        from pysqlite2 import dbapi2 as sqlite
+    except ImportError:
+        # Using SQLITE 1.x
+        sqlite2 = False
+        import sqlite
     
-
 from base import TitledObject
 
 import table

Modified: trunk/thuban/Thuban/version.py
===================================================================
--- trunk/thuban/Thuban/version.py	2009-03-18 11:11:31 UTC (rev 2870)
+++ trunk/thuban/Thuban/version.py	2009-03-20 13:10:25 UTC (rev 2871)
@@ -41,7 +41,7 @@
 #
 
 thuban_branch = "1.2"
-thuban_release = "svn"
+thuban_release = "1"
 
 
 
@@ -115,21 +115,29 @@
 
 # PySQLite
 try:
-    from pysqlite2 import dbapi2 as sqlite
+    import sqlite3 as sqlite
 except ImportError:
-    import sqlite
+    try:
+        from pysqlite2 import dbapi2 as sqlite
+    except ImportError:
+        import sqlite
 versions['pysqlite'] = sqlite.version
 versions['pysqlite-tuple'] = make_tuple(sqlite.version)
 
 # SQLite
 try:
-    from pysqlite2._sqlite import sqlite_version
+    from sqlite3 import sqlite_version
     versions['sqlite'] = sqlite_version
     versions['sqlite-tuple'] = make_tuple(sqlite_version)
 except ImportError:
-    from _sqlite import sqlite_version
-    versions['sqlite'] = sqlite_version()
-    versions['sqlite-tuple'] = make_tuple(sqlite_version())
+    try:
+        from pysqlite2._sqlite import sqlite_version
+        versions['sqlite'] = sqlite_version
+        versions['sqlite-tuple'] = make_tuple(sqlite_version)
+    except ImportError:
+        from _sqlite import sqlite_version
+        versions['sqlite'] = sqlite_version()
+        versions['sqlite-tuple'] = make_tuple(sqlite_version())
 
 # GDAL
 from  Thuban.Model.resource import has_gdal_support



More information about the Thuban-commits mailing list