Debugging ignored patches

Mauro Carvalho Chehab mchehab at infradead.org
Thu Sep 24 01:07:43 EST 2009


Hi Jeremy,

Em Tue, 22 Sep 2009 22:36:25 -0700
Jeremy Kerr <jk at ozlabs.org> escreveu:

> This could be for a few reasons; most often it's a character-set encoding 
> problem with the patch

The way python was written, it imposes a penalty to everyone with accents on
their names. In the case of patchwork, this happens either to some mail header
or to the body (where some accented author name may be inside the source code),
by just crashing any python script whenever it founs some string has non pure
American Standard Code for Information Interchange (ASCII) character is found
on any string he needs to parse or write. I dunno what python authors have
against people with accents, but it would be good if we could find a way to
solve it by globally changing the default on patchwork to utf8, avoiding to
add .utf8() to all possible places where this happen, eventually forgetting to
patch something. 

Apparently, we'll have additional changes on it on python 3 [1].

It seems, from python docs, that there are some ways to setup the
environment to work properly, but, at least on the tests I did here, some of
those fixes like this one:
# -*- coding: utf-8 -*-

Doesn't work on all cases.

Another alternative is to use [2]:
  create a /usr/lib/python2.4/site-packages/sitecustomize.py (for python 2.4)
with:
  import sys
  sys.setdefaultencoding('utf-8')

But this has two issues:
 - this needs to be set on every machine where patchwork will run;
 - if you upgrade from one python version to another, you'll need to move sitepackage.pl

I haven't tried, but maybe if we add sys.setdefaultencoding('utf-8') to
patchwork scripts may solve it on a more elegant way.

[1] http://www.python.org/dev/peps/pep-3120/
[2] http://plone.org/support/forums/core#nabble-td3502396


Cheers,
Mauro


More information about the Patchwork mailing list