Skip to content

Commit

Permalink
fix for #1
Browse files Browse the repository at this point in the history
  • Loading branch information
erpas committed Jan 27, 2017
1 parent 9a9fc18 commit f6f9932
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion GeoCat/dbutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ def get_postgres_conn_info(selected):
return {}

conn_info = {}
conn_info['dsn'] = None
conn_info["host"] = settings.value("host", "", type=str)
conn_info["port"] = settings.value("port", 432, type=int)
conn_info["port"] = settings.value("port", 5432, type=int)
conn_info["database"] = settings.value("database", "", type=str)
username = settings.value("username", "", type=str)
password = settings.value("password", "", type=str)
Expand Down
1 change: 1 addition & 0 deletions GeoCat/geo_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def unload(self):

def run(self):
"""Run method that performs all the real work"""
self.dlg._setup_config()
# refresh custom columns widgets
self.dlg.setup_custom_widgets()
# clear any previuos search text and results
Expand Down
7 changes: 5 additions & 2 deletions GeoCat/geo_cat_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ def _setup_config(self):
self.config['cat_table'] = '"%s"' % s.value('GeoCat/metadataTableName', '', type=str)
self.config['title_col'] = '"%s"' % s.value('GeoCat/titleColumn', '', type=str)
self.config['abstract_col'] = '"%s"' % s.value('GeoCat/abstractColumn', '', type=str)
self.config['date_col'] = '"date_published"' # TODO
self.config['schema_col'] = '"%s"' % s.value('GeoCat/gisLayerSchemaCol', '', type=str)
self.config['table_col'] = '"%s"' % s.value('GeoCat/gisLayerTableCol', '', type=str)

def _db_cur(self):
con_info = get_postgres_conn_info(self.config['connection'])
if not self.config['connection']:
return None
con = get_connection(con_info)
return con.cursor(cursor_factory=DictCursor)

Expand All @@ -133,6 +134,9 @@ def search(self):
# import pydevd; pydevd.settrace('localhost', port=5678)

cur = self._db_cur()
if not cur:
self.bar_warn('There is no connection defined.')
return

search_text = self.searchLineEdit.text()

Expand Down Expand Up @@ -166,7 +170,6 @@ def search(self):
SELECT
cat.""" + self.config['title_col'] + """,
cat.""" + self.config['abstract_col'] + """,
-- cat.""" + self.config['date_col'] + """,
cat.""" + self.config['schema_col'] + """,
cat.""" + self.config['table_col'] + """,
gc.f_geometry_column,
Expand Down

0 comments on commit f6f9932

Please sign in to comment.