Error 500 on mail notification creation when "Approved" translation is unicode

Issue #95 resolved
Jérémy Longo created an issue

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]

Comments (9)

  1. Mads Kiilerich

    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?

  2. Jérémy Longo reporter

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

  3. Mads Kiilerich

    Right, thanks!

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

  4. Jérémy Longo reporter

    adding

    from kallithea.lib.utils2 import safe_unicode
    

    and using safe_unicode works as well.

  5. Log in to comment