Kallithea issues archive

Issue #95: Error 500 on mail notification creation when "Approved" translation is unicode

Reported by: Jérémy Longo
State: resolved
Created on: 2015-02-03 08:32
Updated on: 2015-02-25 15:41

Description

traced it to model/notification.py,

Fix :

replace

l = [str(x) for x in [kwargs.get('status_change'), kwargs.get('closing_pr') and _('Closing')] if x]

with

l = [unicode(x) for x in [kwargs.get('status_change'), kwargs.get('closing_pr') and _('Closing')] if x]

Attachments

Comments

Comment by Jérémy Longo, on 2015-02-03 11:07

Comment by Mads Kiilerich, on 2015-02-05 01:38

I wonder why I put that str() there in the first place. I guess that is a leftover from previous iterations.

Does it also work for you if you use 'x for x in ...' instead?

Comment by Jérémy Longo, on 2015-02-05 08:47

Nope, I get the following error : Error - <type 'exceptions.TypeError'>: sequence item 0: expected string, LazyString found

Comment by Mads Kiilerich, on 2015-02-05 20:19

Right, thanks!

Then I think it should be safe_unicode. I will put a patch in the pipeline ...

Comment by Jérémy Longo, on 2015-02-05 20:21

Thanks !

Comment by Mads Kiilerich, on 2015-02-05 20:52

can you confirm that safe_unicode works too?

Comment by Jérémy Longo, on 2015-02-05 21:06

adding

from kallithea.lib.utils2 import safe_unicode

and using safe_unicode works as well.

Comment by Thomas De Schampheleire, on 2015-02-25 15:24

This issue can be closed, has been fixed with commit 3078f33e13d3249c6ad39cccd940e64706ce11ed.

Comment by Mads Kiilerich, on 2015-02-25 15:41