gnumed-bugs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-bugs] <bug>: Created a patient whose demographic region


From: Karsten Hilbert
Subject: Re: [Gnumed-bugs] <bug>: Created a patient whose demographic region
Date: Tue, 21 Jul 2009 16:44:42 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Jul 20, 2009 at 06:35:15PM -0400, Dr.Leonard Horatio McCoy wrote:

> user comment  : Created a patient whose demographic region I set to Ontario 
> but whose Country I set to "Albania"

...

> 2009-07-20 15:08:52  DEBUG     gm.gui 
> (/home/jbusser/rc4/Gnumed/wxpython/gmExceptionHandlingWidgets.py::handle_uncaught_exception_wx()
>  #49): unhandled exception caught:
> Traceback (most recent call last):
>   File "/home/jbusser/rc4/Gnumed/wxpython/gmEditArea.py", line 179, in 
> _on_save_button_pressed
>     if self._PNL_ea.save():
>   File "/home/jbusser/rc4/Gnumed/wxpython/gmEditArea.py", line 109, in save
>     if self._save_as_new():
>   File "/home/jbusser/rc4/Gnumed/wxpython/gmDemographicsWidgets.py", line 
> 2098, in _save_as_new
>     country = self._PRW_country.GetData()
>   File "/home/jbusser/rc4/Gnumed/business/gmPerson.py", line 838, in 
> link_address
>     subunit = subunit
>   File "/home/jbusser/rc4/Gnumed/business/gmDemographicRecord.py", line 166, 
> in create_address
>     rows, idx = gmPG2.run_rw_queries(queries = queries, return_data = True)
>   File "/home/jbusser/rc4/Gnumed/pycommon/gmPG2.py", line 1081, in 
> run_rw_queries
>     curs.execute(query['cmd'], args)
>   File "/usr/lib/python2.5/site-packages/psycopg2/extras.py", line 89, in 
> execute
>     return _cursor.execute(self, query, vars, async)
> InternalError: => Cannot set address [AL, ON, , ].
> CONTEXT:  SQL statement "SELECT dem.create_urb( $1 ,  $2 ,  $3 ,  $4 )"
> PL/pgSQL function "create_street" line 12 at SQL statement
> SQL statement "SELECT dem.create_street( $1 ,  $2 ,  $3 ,  $4 ,  $5 )"
> PL/pgSQL function "create_address" line 14 at SQL statement

(disregarding that you didn't enter anything into
zipcode/street which really should have triggered a proper
error message anyway)

The database refused to save this address because it did not
recognize Ontario to exist as a region of Albania, which is
quite reasonable. However, I did improve the error handling
- the validity check for address data only checked

- is there any address data ?
- if so is there sufficient address data ?
- are region and state *each* valid

It failed to check

- are region and state an acceptable combination

because that would mean a database query on every check.

Hence the exception on saving. It will now catch the
exception and tell you that the address seems invalid and
that you must add it via the Demographics plugin now (we
cannot fail the save because the identity is already saved
at that point).

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346




reply via email to

[Prev in Thread] Current Thread [Next in Thread]