gnumed-bugs
[Top][All Lists]
Advanced

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

Re: [Gnumed-bugs] <bug>: <user did not comment on bug report>


From: Karsten Hilbert
Subject: Re: [Gnumed-bugs] <bug>: <user did not comment on bug report>
Date: Thu, 16 Jan 2014 12:59:50 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Hello Hoeke,

thanks for your report.

> user comment  : <user did not comment on bug report>
> 
> client version: 1.4.4

It seems you have been trying to set up a user:

> 2014-01-15 10:55:00  DEBUG      >>> execution frame [__on_add_new_staff] in 
> [D:\workplace\gnumed-client.1.4.4\build\pyi.win32\gnumed\outPYZ1.pyz\Gnumed.wxpython.gmGuiMain]
>  at line 2855 <<<
> 2014-01-15 10:55:00  DEBUG                      self = 
> <Gnumed.wxpython.gmGuiMain.gmTopLevelFrame; proxy of <Swig Object of type 
> 'wxFrame *' at 0x46928b8> >
> 2014-01-15 10:55:00  DEBUG                     event = 
> <wx._core.CommandEvent; proxy of <Swig Object of type 'wxCommandEvent *' at 
> 0x18ed2c> >

by creating a new person:

> 2014-01-15 10:55:00  DEBUG      >>> execution frame [create_new_person] in 
> [D:\workplace\gnumed-client.1.4.4\build\pyi.win32\gnumed\outPYZ1.pyz\Gnumed.wxpython.gmPersonCreationWidgets]
>  at line 67 <<<
> 2014-01-15 10:55:00  DEBUG                  activate = True
> 2014-01-15 10:55:00  DEBUG                       dlg = 
> <Gnumed.wxpython.gmEditArea.cGenericEditAreaDlg2; proxy of <Swig Object of 
> type 'wxDialog *' at 0x33261c0> >
> 2014-01-15 10:55:00  DEBUG                    parent = 
> <Gnumed.wxpython.gmGuiMain.gmTopLevelFrame; proxy of <Swig Object of type 
> 'wxFrame *' at 0x46928b8> >
> 2014-01-15 10:55:00  DEBUG                 countries = [[u'NL', 
> u'Netherlands']]
> 2014-01-15 10:55:00  DEBUG                        ea = 
> <Gnumed.wxpython.gmPersonCreationWidgets.cNewPatientEAPnl; proxy of <Swig 
> Object of type 'wxPanel *' at 0x4e546b8> >
> 2014-01-15 10:55:00  DEBUG                def_region = Zeeland
> 2014-01-15 10:55:00  DEBUG                     dbcfg = 
> <Gnumed.pycommon.gmCfg.cCfgSQL instance at 0x04EA5FD0>
> 2014-01-15 10:55:00  DEBUG               def_country = NL

The error you encounter is with displaying age, dob and gender
in the middle of the top panel:

> 2014-01-15 10:54:59  DEBUG     unhandled exception caught:
> Traceback (most recent call last):
>   File 
> "D:\workplace\gnumed-client.1.4.4\build\pyi.win32\gnumed\outPYZ1.pyz\wx._core",
>  line 14669, in <lambda>
>   File 
> "D:\workplace\gnumed-client.1.4.4\build\pyi.win32\gnumed\outPYZ1.pyz\Gnumed.wxpython.gmTopPanel",
>  line 124, in __update_age_label
> TypeError: coercing to Unicode: need string or buffer, instance found

The line it is reported in is:

                tt = _('Gender: %s (%s) - %s\n') % (
                        self.curr_pat.gender_symbol,
                        self.curr_pat['gender'],
                        self.curr_pat.gender_string
                )

more specifically

                        self.curr_pat.gender_string

Now, gender_string should only ever return a unicode
string from the person object (and not an instance):

        def _get_gender_string(self):
                return map_gender2string(gender = 
self._payload[self._idx['gender']])

        gender_string = property(_get_gender_string, lambda x:x)

        def map_gender2string(gender=None):
                """Maps GNUmed related i18n-aware gender specifiers to a 
human-readable string."""

                global __gender2string_map

                if __gender2string_map is None:
                        genders, idx = get_gender_list()
                        __gender2string_map = {
                                'm': _('male'),
                                'f': _('female'),
                                'tf': u'',
                                'tm': u'',
                                'h': u''
                        }
                        for g in genders:
                                __gender2string_map[g[idx['l10n_tag']]] = 
g[idx['l10n_label']]
                                __gender2string_map[g[idx['tag']]] = 
g[idx['l10n_label']]

                return __gender2string_map[gender]

It used to not deal with gender being NULL/None (which
*would* be an instance *but* coerces just fine to %s).
Also, gender cannot really have been NULL/None since
the client does not allow NOT entering a gender. However,
the database does allow that (since we once thought
about supporting that). This would require the user
to manipulate a patient record at the database level
which is unlikely in your case and also does not fit
in with your creating a GNUmed user from a *new*
person (because when should you have modified that
new person record in the database ?).

Another unlikely possibility would be that the
gender mapping table in the database contains
strange values.

I have, at any rate, added some logging and made extra
sure most everything involved is unicode in the first
place such that no "coercing to unicode" should be needed.
Also display code *can* now deal with a no-gender case,
whichever way that would come about.

I see that you have successfully added yourself to
the public database as a person. So maybe the problem
has resolved itself for you in the meantime.

All in all the exact cause of your problem I haven't
been able to pinpoint (and thus fix) just yet. One
part of the equation is that Windows does not provide
as much stack trace details as Linux does under the
circumstances this problem showed up.

Nevertheless I have found a few bugs and inconsistencies
along the way which are now fixed.

Maybe if you can describe the exact steps for
reproducing this exception we can find out more.

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



reply via email to

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