[med-svn] [gnumed-client] 02/06: New upstream version 1.6.15+dfsg
Andreas Tille
tille at debian.org
Mon Nov 13 12:48:14 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository gnumed-client.
commit 25bd8fe5d691c15fd0f797cac42e83b8df88159f
Author: Andreas Tille <tille at debian.org>
Date: Mon Nov 13 13:32:42 2017 +0100
New upstream version 1.6.15+dfsg
---
client/CHANGELOG | 18 +++
client/business/gmDICOM.py | 16 +++
client/business/gmXdtObjects.py | 3 -
client/doc/gnumed.conf.example | 9 +-
client/doc/schema/gnumed-entire_schema.html | 2 +-
client/etc/gnumed/gnumed-client.conf.example | 9 +-
client/gm-from-vcs.conf | 9 +-
client/gnumed.py | 2 +-
client/pycommon/gmMimeLib.py | 18 ++-
client/pycommon/gmPG2.py | 81 ++++++--------
client/pycommon/gmPsql.py | 154 ++++++++++++--------------
client/wxpython/gmDocumentWidgets.py | 5 +-
client/wxpython/gmExceptionHandlingWidgets.py | 12 +-
client/wxpython/gmPatOverviewWidgets.py | 2 +-
14 files changed, 182 insertions(+), 158 deletions(-)
diff --git a/client/CHANGELOG b/client/CHANGELOG
index 1e15d80..55e6a4c 100644
--- a/client/CHANGELOG
+++ b/client/CHANGELOG
@@ -6,6 +6,16 @@
# rel-1-6-patches
------------------------------------------------
+ 1.6.15
+
+FIX: exception on tooltipping patient overview inbox item
+FIX: exception in cursor/connection state logging w/ older psycopg2's
+FIX: exception on import error inside portable app
+
+IMPROVED: use Dicom[RequestingPhysician] if available
+IMPROVED: user visible rendering of raw DICOM strings
+IMPROVED: baptize SCRAM for PG passwords in settings check
+
1.6.14
FIX: exception when having issues with calculating eGFR in medication plugin
@@ -1870,6 +1880,14 @@ FIX: missing cast to ::text in dem.date_trunc_utc() calls
# gnumed_v21
------------------------------------------------
+ 21.15
+
+FIX: handle SQL_INHERITANCE in a way compatible with PG10
+FIX: untyped UNIONs not tolerated by PG10 anymore
+FIX: RETURNS UNKNOWN functions not tolerated by PG10 anymore
+
+IMPROVED: script to adjust db settings
+
21.12
IMPROVED: logging on dem.identity/dem.names uniqueness violation
diff --git a/client/business/gmDICOM.py b/client/business/gmDICOM.py
index 279df3b..07f22fb 100644
--- a/client/business/gmDICOM.py
+++ b/client/business/gmDICOM.py
@@ -13,6 +13,7 @@ __author__ = "K.Hilbert <Karsten.Hilbert at gmx.net>"
import io
import os
import sys
+import re as regex
import logging
import httplib # needed for exception names thrown by httplib2, duh |-(
import socket # needed for exception names thrown by httplib2, duh |-(
@@ -673,6 +674,7 @@ class cOrthancServer:
pat_dict[key] = None
if pat_dict[key] == u'':
pat_dict[key] = None
+ pat_dict[key] = cleanup_dicom_string(pat_dict[key])
studies_by_patient.append(pat_dict)
# loop over studies of patient
@@ -687,6 +689,7 @@ class cOrthancServer:
'time': None,
'description': None,
'referring_doc': None,
+ 'requesting_doc': None,
'radiology_org': None,
'series': []
}
@@ -707,6 +710,10 @@ class cOrthancServer:
except KeyError:
pass
try:
+ study_dict['requesting_doc'] = orth_study['MainDicomTags'][u'RequestingPhysician'].strip()
+ except KeyError:
+ pass
+ try:
study_dict['radiology_org'] = orth_study['MainDicomTags'][u'InstitutionName'].strip()
except KeyError:
pass
@@ -717,6 +724,7 @@ class cOrthancServer:
study_dict[key] = None
if study_dict[key] == u'':
study_dict[key] = None
+ study_dict[key] = cleanup_dicom_string(study_dict[key])
study_dict['all_tags'] = {}
try:
orth_study['PatientMainDicomTags']
@@ -794,6 +802,8 @@ class cOrthancServer:
if series_dict['time'] == study_dict['time']:
_log.debug('<series time> matches <study time>, ignoring time')
series_dict['time'] = None
+ for key in series_dict:
+ series_dict[key] = cleanup_dicom_string(series_dict[key])
series_dict['all_tags'] = {}
for key in orth_series.keys():
if key == 'MainDicomTags':
@@ -946,6 +956,12 @@ class cOrthancServer:
except StandardError:
return content
+#------------------------------------------------------------
+def cleanup_dicom_string(dicom_str):
+ if not isinstance(dicom_str, basestring):
+ return dicom_str
+ return regex.sub('\^+', ' ', dicom_str.strip(u'^'))
+
#============================================================
# main
#------------------------------------------------------------
diff --git a/client/business/gmXdtObjects.py b/client/business/gmXdtObjects.py
index f130ae4..bbab02e 100644
--- a/client/business/gmXdtObjects.py
+++ b/client/business/gmXdtObjects.py
@@ -11,9 +11,6 @@ __license__ = "GPL"
import os.path, sys, linecache, io, re as regex, time, datetime as pyDT, logging, io
-import mx.DateTime as mxDT
-
-
if __name__ == '__main__':
sys.path.insert(0, '../../')
from Gnumed.pycommon import gmDateTime, gmTools
diff --git a/client/doc/gnumed.conf.example b/client/doc/gnumed.conf.example
index 47806f8..a62e4af 100644
--- a/client/doc/gnumed.conf.example
+++ b/client/doc/gnumed.conf.example
@@ -20,7 +20,7 @@
# -------------------------------------------------------------
[preferences]
-profile = GNUmed database on this machine ("local": Linux/Mac) (gnumed_v21@)
+profile = GNUmed database at publicdb.gnumed.de (PUBLIC) (gnumed_v21 at publicdb.gnumed.de)
login = any-doc
@@ -111,11 +111,12 @@ public/open access = 1
help desk = GNUmed Development List <gnumed-bugs at gnu.org>
last known workplaces = $last known workplaces$
-xxxDEFAULTxxx
-Local Default
-Front Desk
Clinician
+Front Desk
GNUmed Default
+Librarian Release (0.2)
+Local Default
+xxxDEFAULTxxx
$last known workplaces$
# -------------------------------------------------------------
diff --git a/client/doc/schema/gnumed-entire_schema.html b/client/doc/schema/gnumed-entire_schema.html
index 6a174d8..69f33fe 100644
--- a/client/doc/schema/gnumed-entire_schema.html
+++ b/client/doc/schema/gnumed-entire_schema.html
@@ -112,7 +112,7 @@
<body>
<!-- Primary Index -->
- <p><br><br>Dumped on 2017-08-31</p>
+ <p><br><br>Dumped on 2017-10-28</p>
<h1><a name="index">Index of database - gnumed_v21</a></h1>
<ul>
diff --git a/client/etc/gnumed/gnumed-client.conf.example b/client/etc/gnumed/gnumed-client.conf.example
index 47806f8..a62e4af 100644
--- a/client/etc/gnumed/gnumed-client.conf.example
+++ b/client/etc/gnumed/gnumed-client.conf.example
@@ -20,7 +20,7 @@
# -------------------------------------------------------------
[preferences]
-profile = GNUmed database on this machine ("local": Linux/Mac) (gnumed_v21@)
+profile = GNUmed database at publicdb.gnumed.de (PUBLIC) (gnumed_v21 at publicdb.gnumed.de)
login = any-doc
@@ -111,11 +111,12 @@ public/open access = 1
help desk = GNUmed Development List <gnumed-bugs at gnu.org>
last known workplaces = $last known workplaces$
-xxxDEFAULTxxx
-Local Default
-Front Desk
Clinician
+Front Desk
GNUmed Default
+Librarian Release (0.2)
+Local Default
+xxxDEFAULTxxx
$last known workplaces$
# -------------------------------------------------------------
diff --git a/client/gm-from-vcs.conf b/client/gm-from-vcs.conf
index 47806f8..a62e4af 100644
--- a/client/gm-from-vcs.conf
+++ b/client/gm-from-vcs.conf
@@ -20,7 +20,7 @@
# -------------------------------------------------------------
[preferences]
-profile = GNUmed database on this machine ("local": Linux/Mac) (gnumed_v21@)
+profile = GNUmed database at publicdb.gnumed.de (PUBLIC) (gnumed_v21 at publicdb.gnumed.de)
login = any-doc
@@ -111,11 +111,12 @@ public/open access = 1
help desk = GNUmed Development List <gnumed-bugs at gnu.org>
last known workplaces = $last known workplaces$
-xxxDEFAULTxxx
-Local Default
-Front Desk
Clinician
+Front Desk
GNUmed Default
+Librarian Release (0.2)
+Local Default
+xxxDEFAULTxxx
$last known workplaces$
# -------------------------------------------------------------
diff --git a/client/gnumed.py b/client/gnumed.py
index 70e3c7b..db24db2 100644
--- a/client/gnumed.py
+++ b/client/gnumed.py
@@ -91,7 +91,7 @@ against. Please run GNUmed as a non-root user.
sys.exit(1)
#----------------------------------------------------------
-current_client_version = u'1.6.14'
+current_client_version = u'1.6.15'
current_client_branch = u'1.6'
_log = None
diff --git a/client/pycommon/gmMimeLib.py b/client/pycommon/gmMimeLib.py
index 417f853..7b6510d 100644
--- a/client/pycommon/gmMimeLib.py
+++ b/client/pycommon/gmMimeLib.py
@@ -46,8 +46,13 @@ def guess_mimetype(filename = None):
if (prop == 'mimetype') and (val != worst_case):
return val
except ImportError:
- _log.debug('module <extractor> (python wrapper for libextractor) not installed')
-
+ _log.debug(u'module <extractor> (python wrapper for libextractor) not installed')
+ except OSError as exc:
+ # winerror 126, errno 22
+ if exc.errno == 22:
+ _log.exception(u'module <extractor> (python wrapper for libextractor) not installed')
+ else:
+ raise
ret_code = -1
# 2) use "file" system command
@@ -385,10 +390,11 @@ if __name__ == "__main__":
#_get_system_startfile_cmd(filename)
#print(_system_startfile_cmd)
- #print(guess_mimetype(filename))
+ print(guess_mimetype(filename))
#print(get_viewer_cmd(guess_mimetype(filename), filename))
#print(guess_ext_by_mimetype(mimetype=filename))
#call_viewer_on_file(aFile = filename, block=None)
- status, desc = describe_file(filename)
- print status
- print desc
+
+ #status, desc = describe_file(filename)
+ #print status
+ #print desc
diff --git a/client/pycommon/gmPG2.py b/client/pycommon/gmPG2.py
index 36d2f87..60f5f4c 100644
--- a/client/pycommon/gmPG2.py
+++ b/client/pycommon/gmPG2.py
@@ -1549,6 +1549,10 @@ def capture_conn_state(conn=None):
conn_status = u'%s (%s)' % (conn.status, map_psyco_conn_status2str[conn.status])
if conn.closed != 0:
conn_status = u'undefined (%s)' % conn_status
+ try:
+ conn_deferrable = conn.deferrable
+ except AttributeError:
+ conn_deferrable = u'unavailable'
d = {
u'identity': id(conn),
@@ -1560,7 +1564,7 @@ def capture_conn_state(conn=None):
u'autocommit': conn.autocommit,
u'isolation level (psyco)': isolation_level,
u'async': conn.async,
- u'deferrable': conn.deferrable,
+ u'deferrable': conn_deferrable,
u'transaction status': u'%s (%s)' % (tx_status, map_psyco_tx_status2str[tx_status]),
u'connection status': conn_status,
u'executing async op': conn.isexecuting(),
@@ -1597,6 +1601,10 @@ def capture_cursor_state(cursor=None):
isolation_level = u'tx aborted or unknown, cannot retrieve'
else:
isolation_level = conn.isolation_level
+ try:
+ conn_deferrable = conn.deferrable
+ except AttributeError:
+ conn_deferrable = u'unavailable'
if cursor.query is None:
query = u'<no query>'
@@ -1638,7 +1646,7 @@ Query
isolation_level,
conn.encoding,
conn.async,
- conn.deferrable,
+ conn_deferrable,
conn.readonly,
map_psyco_tx_status2str[tx_status],
map_psyco_conn_status2str[conn.status],
@@ -1853,7 +1861,7 @@ def run_rw_queries(link_obj=None, queries=None, end_tx=False, return_data=None,
if verbose:
_log.debug(capture_cursor_state(curs))
for notice in notices_accessor.notices:
- _log.debug(notice.strip(u'\n').strip(u'\r'))
+ _log.debug(unicode(notice, 'utf8', 'replace').strip(u'\n').strip(u'\r'))
del notices_accessor.notices[:]
# DB related exceptions
except dbapi.Error as pg_exc:
@@ -1868,7 +1876,7 @@ def run_rw_queries(link_obj=None, queries=None, end_tx=False, return_data=None,
continue
_log.error(u'PG diags %s: %s', prop, val)
for notice in notices_accessor.notices:
- _log.error(notice.strip(u'\n').strip(u'\r'))
+ _log.error(unicode(notice, 'utf8', 'replace').strip(u'\n').strip(u'\r'))
del notices_accessor.notices[:]
pg_exc = make_pg_exception_fields_unicode(pg_exc)
_log.error(u'PG error code: %s', pg_exc.pgcode)
@@ -1912,7 +1920,7 @@ def run_rw_queries(link_obj=None, queries=None, end_tx=False, return_data=None,
_log.exception('error running query in RW connection')
_log.error(capture_cursor_state(curs))
for notice in notices_accessor.notices:
- _log.debug(notice.strip(u'\n').strip(u'\r'))
+ _log.debug(unicode(notice, 'utf8', 'replace').strip(u'\n').strip(u'\r'))
del notices_accessor.notices[:]
gmLog2.log_stack_trace()
try:
@@ -2289,30 +2297,30 @@ def sanity_check_database_settings():
options2check = {
# setting: [expected value, risk, fatal?]
- u'allow_system_table_mods': [u'off', u'system breakage', False],
- u'check_function_bodies': [u'on', u'suboptimal error detection', False],
- u'datestyle': [u'ISO', u'faulty timestamp parsing', True],
- u'default_transaction_isolation': [u'read committed', u'faulty database reads', True],
- u'default_transaction_read_only': [u'on', u'accidental database writes', False],
- u'fsync': [u'on', u'data loss/corruption', True],
- u'full_page_writes': [u'on', u'data loss/corruption', False],
- u'lc_messages': [u'C', u'suboptimal error detection', False],
- u'password_encryption': [u'on', u'breach of confidentiality', False],
- #u'regex_flavor': [u'advanced', u'query breakage', False], # 9.0 doesn't support this anymore, default now advanced anyway
- u'synchronous_commit': [u'on', u'data loss/corruption', False],
- u'sql_inheritance': [u'on', u'query breakage, data loss/corruption', True],
- u'ignore_checksum_failure': [u'off', u'data loss/corruption', False], # starting with PG 9.3
- u'track_commit_timestamp': [u'on', u'suboptimal auditing', False] # starting with PG 9.3
+ u'allow_system_table_mods': [[u'off'], u'system breakage', False],
+ u'check_function_bodies': [[u'on'], u'suboptimal error detection', False],
+ u'datestyle': [[u'ISO'], u'faulty timestamp parsing', True],
+ u'default_transaction_isolation': [[u'read committed'], u'faulty database reads', True],
+ u'default_transaction_read_only': [[u'on'], u'accidental database writes', False],
+ u'fsync': [[u'on'], u'data loss/corruption', True],
+ u'full_page_writes': [[u'on'], u'data loss/corruption', False],
+ u'lc_messages': [[u'C'], u'suboptimal error detection', False],
+ u'password_encryption': [[u'on', u'md5', u'scram-sha-256'], u'breach of confidentiality', False],
+ #u'regex_flavor': [[u'advanced'], u'query breakage', False], # 9.0 doesn't support this anymore, default now advanced anyway
+ u'synchronous_commit': [[u'on'], u'data loss/corruption', False],
+ u'sql_inheritance': [[u'on'], u'query breakage, data loss/corruption', True], # IF returned (<PG10): better be ON, if NOT returned (PG10): hardwired
+ u'ignore_checksum_failure': [[u'off'], u'data loss/corruption', False], # starting with PG 9.3
+ u'track_commit_timestamp': [[u'on'], u'suboptimal auditing', False] # starting with PG 9.3
}
from Gnumed.pycommon import gmCfg2
_cfg = gmCfg2.gmCfgData()
if _cfg.get(option = u'hipaa'):
- options2check[u'log_connections'] = [u'on', u'non-compliance with HIPAA', True]
- options2check[u'log_disconnections'] = [u'on', u'non-compliance with HIPAA', True]
+ options2check[u'log_connections'] = [[u'on'], u'non-compliance with HIPAA', True]
+ options2check[u'log_disconnections'] = [[u'on'], u'non-compliance with HIPAA', True]
else:
- options2check[u'log_connections'] = [u'on', u'non-compliance with HIPAA', None]
- options2check[u'log_disconnections'] = [u'on', u'non-compliance with HIPAA', None]
+ options2check[u'log_connections'] = [[u'on'], u'non-compliance with HIPAA', None]
+ options2check[u'log_disconnections'] = [[u'on'], u'non-compliance with HIPAA', None]
cmd = u"SELECT name, setting from pg_settings where name in %(settings)s"
rows, idx = run_ro_queries (
@@ -2327,10 +2335,10 @@ def sanity_check_database_settings():
for row in rows:
option = row['name']
value_found = row['setting']
- value_expected = options2check[option][0]
+ values_expected = options2check[option][0]
risk = options2check[option][1]
fatal_setting = options2check[option][2]
- if value_found != value_expected:
+ if value_found not in values_expected:
if fatal_setting is True:
found_error = True
elif fatal_setting is False:
@@ -2342,7 +2350,7 @@ def sanity_check_database_settings():
raise ValueError(u'invalid database configuration sanity check')
msg.append(_(' option [%s]: %s') % (option, value_found))
msg.append(_(' risk: %s') % risk)
- _log.warning('PG option [%s] set to [%s], expected [%s], risk: <%s>' % (option, value_found, value_expected, risk))
+ _log.warning('PG option [%s] set to [%s], expected %s, risk: <%s>' % (option, value_found, values_expected, risk))
if found_error:
return 2, u'\n'.join(msg)
@@ -2491,27 +2499,6 @@ class cAdapterPyDateTime(object):
def getquoted(self):
return _timestamp_template % self.__dt.isoformat()
-## remove for 0.9
-## ----------------------------------------------------------------------
-##class cAdapterMxDateTime(object):
-##
-## def __init__(self, dt):
-## if dt.tz == '???':
-## _log.info('[%s]: no time zone string available in (%s), assuming local time zone', self.__class__.__name__, dt)
-## self.__dt = dt
-##
-## def getquoted(self):
-## # under some locale settings the mx.DateTime ISO formatter
-## # will insert "," into the ISO string,
-## # while this is allowed per the ISO8601 spec PostgreSQL
-## # cannot currently handle that,
-## # so map those "," to "." to make things work:
-## return mxDT.ISO.str(self.__dt).replace(',', '.')
-##
-## ----------------------------------------------------------------------
-## PostgreSQL -> Python
-## ----------------------------------------------------------------------
-
#=======================================================================
# main
#-----------------------------------------------------------------------
diff --git a/client/pycommon/gmPsql.py b/client/pycommon/gmPsql.py
index ad1b963..682d034 100644
--- a/client/pycommon/gmPsql.py
+++ b/client/pycommon/gmPsql.py
@@ -9,28 +9,16 @@ __author__ = "Ian Haywood"
__license__ = "GPL v2 or later (details at http://www.gnu.org)"
# stdlib
-import sys, os, string, re, urllib2, logging, io
+import sys
+import os
+import re
+import logging
+import io
_log = logging.getLogger('gm.bootstrapper')
unformattable_error_id = 12345
-#===================================================================
-def shellrun (cmd):
- """
- runs the shell command and returns a string
- """
- stdin, stdout = os.popen4 (cmd.group (1))
- r = stdout.read ()
- stdout.close()
- stdin.close()
- return r
-#-------------------------------------------------------------------
-def shell(str):
- """
- performs backtick shell extension in a string
- """
- return re.sub (r"`(.*)`", shellrun, str)
#===================================================================
class Psql:
@@ -40,17 +28,16 @@ class Psql:
db : the interpreter to connect to, must be a DBAPI compliant interface
"""
self.conn = conn
- self.vars = {'ON_ERROR_STOP':None}
+ self.vars = {'ON_ERROR_STOP': None}
#---------------------------------------------------------------
- def match (self, str):
- match = re.match (str, self.line)
+ def match(self, pattern):
+ match = re.match(pattern, self.line)
if match is None:
- ret = 0
- else:
- ret = 1
- self.groups = match.groups ()
- return ret
+ return 0
+
+ self.groups = match.groups()
+ return 1
#---------------------------------------------------------------
def fmt_msg(self, aMsg):
@@ -74,18 +61,17 @@ class Psql:
filename: a file, containg semicolon-separated SQL commands
"""
_log.debug('processing [%s]', filename)
- if re.match ("http://.*", filename) or re.match ("ftp://.*", filename) or re.match ("gopher://.*", filename):
- try:
- self.file = urllib2.urlopen (filename)
- except URLError:
- _log.error(u"cannot access [%s]", filename)
- return 1
+ curs = self.conn.cursor()
+ curs.execute(u'show session authorization')
+ start_auth = curs.fetchall()[0][0]
+ curs.close()
+ _log.debug(u'session auth: %s', start_auth)
+
+ if os.access (filename, os.R_OK):
+ sql_file = io.open(filename, mode = 'rt', encoding = 'utf8')
else:
- if os.access (filename, os.R_OK):
- self.file = io.open(filename, mode = 'rt', encoding = 'utf8')
- else:
- _log.error(u"cannot open file [%s]", filename)
- return 1
+ _log.error(u"cannot open file [%s]", filename)
+ return 1
self.lineno = 0
self.filename = filename
@@ -94,31 +80,18 @@ class Psql:
curr_cmd = ''
curs = self.conn.cursor()
- for self.line in self.file.readlines():
+ for self.line in sql_file.readlines():
self.lineno += 1
if len(self.line.strip()) == 0:
continue
- # \echo
- if self.match (r"^\\echo (.*)"):
- _log.info(self.fmt_msg(shell(self.groups[0])))
- continue
-
- # \qecho
- if self.match (r"^\\qecho (.*)"):
- _log.info(self.fmt_msg(shell (self.groups[0])))
- continue
-
- # \q
- if self.match (r"^\\q"):
- _log.warning(self.fmt_msg(u"script terminated by \\q"))
- return 0
-
# \set
- if self.match (r"^\\set (\S+) (\S+)"):
- self.vars[self.groups[0]] = shell (self.groups[1])
+ if self.match(r"^\\set (\S+) (\S+)"):
+ _log.debug(u'"\set" found: %s', self.groups)
+ self.vars[self.groups[0]] = self.groups[1]
if self.groups[0] == 'ON_ERROR_STOP':
- self.vars['ON_ERROR_STOP'] = int (self.vars['ON_ERROR_STOP'])
+ # adjusting from string to int so that "1" -> 1 -> True
+ self.vars['ON_ERROR_STOP'] = int(self.vars['ON_ERROR_STOP'])
continue
# \unset
@@ -142,7 +115,7 @@ class Psql:
if this_char == "'":
in_string = not in_string
- # detect -- style comments
+ # detect "--"-style comments
if this_char == '-' and next_char == '-' and not in_string:
break
@@ -152,31 +125,39 @@ class Psql:
if this_char == ')' and not in_string:
bracketlevel -= 1
- # found end of command, not inside string, not inside bracket ?
- if not (not in_string and (bracketlevel == 0) and (this_char == ';')):
+ # have we:
+ # - found end of command ?
+ # - are not inside a string ?
+ # - are not inside bracket pair ?
+ if not ((in_string is False) and (bracketlevel == 0) and (this_char == ';')):
curr_cmd += this_char
else:
- try:
- if curr_cmd.strip() != '':
- curs.execute (curr_cmd)
- except Exception as error:
- _log.exception(curr_cmd)
- if re.match (r"^NOTICE:.*", str(error)):
- _log.warning(self.fmt_msg(error))
- else:
- _log.error(self.fmt_msg(error))
- if hasattr(error, 'diag'):
- for prop in dir(error.diag):
- if prop.startswith(u'__'):
- continue
- val = getattr(error.diag, prop)
- if val is None:
- continue
- _log.error(u'PG diags %s: %s', prop, val)
- if self.vars['ON_ERROR_STOP']:
- self.conn.commit()
- curs.close()
- return 1
+ if curr_cmd.strip() != '':
+ try:
+ curs.execute(curr_cmd)
+ try:
+ data = curs.fetchall()
+ _log.debug(u'cursor data: %s', data)
+ except StandardError: # actually: psycopg2.ProgrammingError but no handle
+ pass
+ except Exception as error:
+ _log.exception(curr_cmd)
+ if re.match(r"^NOTICE:.*", str(error)):
+ _log.warning(self.fmt_msg(error))
+ else:
+ _log.error(self.fmt_msg(error))
+ if hasattr(error, 'diag'):
+ for prop in dir(error.diag):
+ if prop.startswith(u'__'):
+ continue
+ val = getattr(error.diag, prop)
+ if val is None:
+ continue
+ _log.error(u'PG diags %s: %s', prop, val)
+ if self.vars['ON_ERROR_STOP']:
+ self.conn.commit()
+ curs.close()
+ return 1
self.conn.commit()
curs.close()
@@ -184,12 +165,17 @@ class Psql:
curr_cmd = ''
this_char = next_char
-
# end of loop over chars
# end of loop over lines
self.conn.commit()
+ curs.execute(u'show session authorization')
+ end_auth = curs.fetchall()[0][0]
curs.close()
+ _log.debug(u'session auth after sql file processing: %s', end_auth)
+ if start_auth != end_auth:
+ _log.error('session auth changed before/after processing sql file')
+
return 0
#===================================================================
@@ -203,7 +189,7 @@ if __name__ == '__main__':
sys.exit()
#from pyPgSQL import PgSQL
- conn = PgSQL.connect (user='gm-dbo', database = 'gnumed')
- psql = Psql (conn)
- psql.run (sys.argv[1])
- conn.close ()
+ conn = PgSQL.connect(user='gm-dbo', database = 'gnumed')
+ psql = Psql(conn)
+ psql.run(sys.argv[1])
+ conn.close()
diff --git a/client/wxpython/gmDocumentWidgets.py b/client/wxpython/gmDocumentWidgets.py
index 36bd8fa..9060797 100644
--- a/client/wxpython/gmDocumentWidgets.py
+++ b/client/wxpython/gmDocumentWidgets.py
@@ -2800,7 +2800,10 @@ class cPACSPluginPnl(wxgPACSPluginPnl, gmRegetMixin.cRegetOnPaintMixin):
gmTools.coalesce(study['description'], u'', u': %s')
),
gmTools.coalesce(study['radiology_org'], u''),
- gmTools.coalesce(study['referring_doc'], u'')
+ gmTools.coalesce (
+ study['referring_doc'],
+ gmTools.coalesce(study['requesting_doc'], u'')
+ )
] )
study_list_data.append(study)
diff --git a/client/wxpython/gmExceptionHandlingWidgets.py b/client/wxpython/gmExceptionHandlingWidgets.py
index 2851766..171d13a 100644
--- a/client/wxpython/gmExceptionHandlingWidgets.py
+++ b/client/wxpython/gmExceptionHandlingWidgets.py
@@ -69,11 +69,18 @@ def __handle_exceptions_on_shutdown(t, v, tb):
gmLog2.log_stack_trace('exception on shutdown', t, v, tb)
return True
+
#-------------------------------------------------------------------------
def __handle_import_error(t, v, tb):
- if t != exceptions.ImportError:
- return False
+ if t == exceptions.OSError:
+ if not hasattr('winerror'):
+ return False
+ if getattr(t, 'winerror') != 126:
+ return False
+ else:
+ if t != exceptions.ImportError:
+ return False
wx.EndBusyCursor()
@@ -93,6 +100,7 @@ def __handle_import_error(t, v, tb):
) % v
)
return True
+
#-------------------------------------------------------------------------
def __handle_ctrl_c(t, v, tb):
diff --git a/client/wxpython/gmPatOverviewWidgets.py b/client/wxpython/gmPatOverviewWidgets.py
index 78092d0..6492b10 100644
--- a/client/wxpython/gmPatOverviewWidgets.py
+++ b/client/wxpython/gmPatOverviewWidgets.py
@@ -340,7 +340,7 @@ class cPatientOverviewPnl(wxgPatientOverviewPnl.wxgPatientOverviewPnl, gmRegetMi
#-----------------------------------------------------
def _calc_inbox_item_tooltip(self, data):
if isinstance(data, gmProviderInbox.cInboxMessage):
- return data.format()
+ return data.format(with_patient = False)
if isinstance(data, gmAutoHints.cDynamicHint):
return u'%s\n\n%s%s\n\n%s %s' % (
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/gnumed-client.git
More information about the debian-med-commit
mailing list