[Thuban-commits] r2787 - in trunk/thuban: . Extensions/ogr Thuban/Model Thuban/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 28 14:54:18 CET 2007


Author: bernhard
Date: 2007-11-28 14:54:17 +0100 (Wed, 28 Nov 2007)
New Revision: 2787

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Extensions/ogr/ogrdialog.py
   trunk/thuban/Thuban/Model/postgisdb.py
   trunk/thuban/Thuban/UI/dbdialog.py
   trunk/thuban/Thuban/UI/mainwindow.py
Log:
Databaseconnections: some fixes.

* Thuban/Model/postgisdb.py(_fetch_table_information()): also
quote the tablename, which otherwise would not work when there is
a "_" in the table name. It probably is a good idea anyway.

* Thuban/UI/dbdialog.py(ChooseDBTableDialog.GetTable()): transform
some resulting strings into internal encoding.

* Thuban/UI/mainwindow.py(AddDBLayer()): print a traceback to stderr
if the dataconnection fails to help analysing when there is a problem.

* Extensions/ogr/ogrdialog.py: Fixed some wx calls building the dialog.


Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2007-11-27 23:54:45 UTC (rev 2786)
+++ trunk/thuban/ChangeLog	2007-11-28 13:54:17 UTC (rev 2787)
@@ -1,5 +1,21 @@
 2007-11-28   Bernhard Reiter <bernhard at intevation.de>
 
+	Databaseconnections: some fixes.
+
+	* Thuban/Model/postgisdb.py(_fetch_table_information()): also
+	quote the tablename, which otherwise would not work when there is
+	a "_" in the table name. It probably is a good idea anyway.
+
+	* Thuban/UI/dbdialog.py(ChooseDBTableDialog.GetTable()): transform
+	some resulting strings into internal encoding.
+
+	* Thuban/UI/mainwindow.py(AddDBLayer()): print a traceback to stderr
+	if the dataconnection fails to help analysing when there is a problem.
+
+	* Extensions/ogr/ogrdialog.py: Fixed some wx calls building the dialog.
+
+2007-11-28   Bernhard Reiter <bernhard at intevation.de>
+
 	Wms-Extension: some fixes in order to make it work again.
 
 	*  Extensions/wms/test/test_parser.py: removed import of adjustpath,

Modified: trunk/thuban/Extensions/ogr/ogrdialog.py
===================================================================
--- trunk/thuban/Extensions/ogr/ogrdialog.py	2007-11-27 23:54:45 UTC (rev 2786)
+++ trunk/thuban/Extensions/ogr/ogrdialog.py	2007-11-28 13:54:17 UTC (rev 2787)
@@ -231,12 +231,12 @@
         # The button box between the connections list box and the table
         # list box
         buttons = wx.FlexGridSizer(3, 1, 0, 0)
-        buttons.Add(20, 80, 0, wx.EXPAND, 0)
+        buttons.Add((20, 80), 0, wx.EXPAND, 0)
         retrieve_button = wx.Button(self, ID_DBCHOOSE_RETRIEVE, _("Retrieve"))
         wx.EVT_BUTTON(self, ID_DBCHOOSE_RETRIEVE, self.OnRetrieve)
         buttons.Add(retrieve_button, 0, wx.ALL
                     |wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 4)
-        buttons.Add(20, 80, 0, wx.EXPAND, 0)
+        buttons.Add((20, 80), 0, wx.EXPAND, 0)
         main_sizer.Add(buttons, 0, wx.EXPAND, 0)
 
         # The list box with the tables

Modified: trunk/thuban/Thuban/Model/postgisdb.py
===================================================================
--- trunk/thuban/Thuban/Model/postgisdb.py	2007-11-27 23:54:45 UTC (rev 2786)
+++ trunk/thuban/Thuban/Model/postgisdb.py	2007-11-28 13:54:17 UTC (rev 2787)
@@ -545,7 +545,7 @@
         cursor = self.db.cursor()
         cursor.execute("SELECT DISTINCT SRID(%s) FROM %s;" %
                        (quote_identifier(self.geometry_column),
-                        self.tablename))
+                        quote_identifier(self.tablename)))
         row = cursor.fetchone()
         if row is not None:
             self.srid = row[0]
@@ -559,7 +559,7 @@
         cursor = self.db.cursor()
         cursor.execute("SELECT DISTINCT GeometryType(%s) FROM %s;"
                        % (quote_identifier(self.geometry_column),
-                          self.tablename))
+                          quote_identifier(self.tablename)))
         row = cursor.fetchone()
         if row is not None:
             self.shape_type = shapetype_map.get(row[0])

Modified: trunk/thuban/Thuban/UI/dbdialog.py
===================================================================
--- trunk/thuban/Thuban/UI/dbdialog.py	2007-11-27 23:54:45 UTC (rev 2786)
+++ trunk/thuban/Thuban/UI/dbdialog.py	2007-11-28 13:54:17 UTC (rev 2787)
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2003, 2004 by Intevation GmbH
+# Copyright (c) 2001, 2003, 2004, 2007 by Intevation GmbH
 # Authors:
 # Martin Mueller <mmueller at intevation.de>
 # Bernhard Herzog <bh at intevation.de>
@@ -19,6 +19,7 @@
     psycopg = None
 
 from Thuban import _
+from Thuban.UI import internal_from_wxstring
 from Thuban.UI.dialogs import NonModalDialog
 from Thuban.Model.table import FIELDTYPE_INT
 from Thuban.Model.postgisdb import ConnectionError, PostGISConnection
@@ -124,8 +125,8 @@
         i = self.lb_tables.GetSelection()
         if i >= 0:
             return (self.selected_conn, self.tables[i],
-                    self.text_id_column.GetValue(),
-                    self.text_geo_column.GetValue())
+                    internal_from_wxstring(self.text_id_column.GetValue()),
+                    internal_from_wxstring(self.text_geo_column.GetValue()))
         return None
 
     def OnRetrieve(self, event):

Modified: trunk/thuban/Thuban/UI/mainwindow.py
===================================================================
--- trunk/thuban/Thuban/UI/mainwindow.py	2007-11-27 23:54:45 UTC (rev 2786)
+++ trunk/thuban/Thuban/UI/mainwindow.py	2007-11-28 13:54:17 UTC (rev 2787)
@@ -18,6 +18,7 @@
 
 import os
 import copy
+import sys, traceback
 
 import wx
 
@@ -628,6 +629,7 @@
                 layer = Layer(title, store)
             except:
                 # Some error occured while initializing the layer
+                traceback.print_exc(file=sys.stderr)
                 self.RunMessageBox(_("Add Layer from database"),
                                    _("Can't open the database table '%s'")
                                    % dbtable)



More information about the Thuban-commits mailing list