[om2009] shr-settings like ? usability ?

Laszlo KREKACS laszlo.krekacs.list at gmail.com
Wed Jul 1 07:27:24 CEST 2009


On Wed, Jul 1, 2009 at 3:10 AM, Xavier Cremaschi<omega.xavier at gmail.com> wrote:
> I tried an ugly modification :
>     if hasattr(item, attribute):
>         value = getattr(item, attribute)
>         if value == None:
>             value = " "
>         if isinstance(value, str) and not len(value):
>             value = " " #bugfix for empty name
>         if self.LetterDict and len(value):
>             if self.label_list.index((part, attribute)) == 0:
>                 letter = value[0]
>

"if self.LetterDict and len(value):"
The len(value) part is not needed, because you already fixed it before.
And if the value is None, the len(value) fails with a TypeError exception.

I pushed a fix which should be enough:
http://git.paroli-project.org/?p=paroli.git;a=commit;h=3af9f956337445dc3772038ba1eeeb8a4e33f406


Thanks for catching!

Laszlo

ps: Im wondering how people manages to add empty contacts and with
value None(!).



More information about the community mailing list