gnumed-bugs
[Top][All Lists]
Advanced

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

Re: [Gnumed-bugs] <bug>: Trying to activate patient from KOrganizer-


From: Karsten Hilbert
Subject: Re: [Gnumed-bugs] <bug>: Trying to activate patient from KOrganizer-
Date: Wed, 27 Feb 2013 23:50:46 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Marc,

thanks for your report.

> user comment  : Trying to activate patient from KOrganizer-List

Someone's actually using this ? :-))

> client version: 1.2.8

> 2013-02-27 15:05:41  DEBUG     gm.gui 
> (/usr/share/gnumed/Gnumed/wxpython/gmExceptionHandlingWidgets.py::handle_uncaught_exception_wx()
>  #186): unhandled exception caught:
> Traceback (most recent call last):
>   File "/usr/share/gnumed/Gnumed/wxpython/gmDataMiningWidgets.py", line 69, 
> in _on_list_item_activated
>     idents = searcher.get_identities(pat_data)
>   File "/usr/share/gnumed/Gnumed/business/gmPersonSearch.py", line 69, in 
> get_identities
>     queries = self._generate_queries(search_term)
>   File "/usr/share/gnumed/Gnumed/business/gmPersonSearch.py", line 446, in 
> _generate_queries_de
>     'args': [_('name: first-last'), '^' + gmTools.capitalize(name_parts[0], 
> mode=gmTools.CAPS_NAMES), '^' + gmTools.capitalize(name_parts[1], 
> mode=gmTools.CAPS_NAMES)]
>   File "/usr/share/gnumed/Gnumed/pycommon/gmTools.py", line 601, in capitalize
>     return capitalize(text=text, mode=CAPS_FIRST)             # until fixed
>   File "/usr/share/gnumed/Gnumed/pycommon/gmTools.py", line 586, in capitalize
>     return text[0].upper() + text[1:]
> IndexError: string index out of range

You found a bug - that entry in KOrganizer seems to have
held the last name only plus a comma, lacking a first name
(anonymized):

> 2013-02-27 15:05:41  DEBUG     gm.logging 
> (/usr/share/gnumed/Gnumed/pycommon/gmLog2.py::log_stack_trace() #155): >>> 
> execution frame [_on_list_item_activated] in 
> [/usr/share/gnumed/Gnumed/wxpython/gmDataMiningWidgets.py] at line 69 <<<
> 2013-02-27 15:05:41  DEBUG     gm.logging 
> (/usr/share/gnumed/Gnumed/pycommon/gmLog2.py::log_stack_trace() #170):        
>      pat_data = Tü*******, 

This led to GNUmed considering "" to be a name part to
search for which confused capitalize() ...

> 2013-02-27 15:05:41  DEBUG     gm.logging 
> (/usr/share/gnumed/Gnumed/pycommon/gmLog2.py::log_stack_trace() #155): >>> 
> execution frame [capitalize] in 
> [/usr/share/gnumed/Gnumed/pycommon/gmTools.py] at line 586 <<<
> 2013-02-27 15:05:41  DEBUG     gm.logging 
> (/usr/share/gnumed/Gnumed/pycommon/gmLog2.py::log_stack_trace() #170):        
>          text = 

... which was the actual bug - it was unable to deal with
empty strings:

>   File "/usr/share/gnumed/Gnumed/pycommon/gmTools.py", line 586, in capitalize
>     return text[0].upper() + text[1:]
> IndexError: string index out of range

Attached find a file which will quick-fix the inability to
capitalize(''). You can drop it into a 1.2.8
client/pycommon/.

For 1.2.9 / 1.3 I have prepared a more complete fix.

Karsten
-- 
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

Attachment: gmTools.py
Description: Text Data


reply via email to

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