[Python-checkins] r68335 - peps/trunk/pep0/pep.py
Tarek Ziadé
ziade.tarek at gmail.com
Mon Jan 5 10:32:06 CET 2009
On Mon, Jan 5, 2009 at 2:38 AM, benjamin. peterson
<python-checkins at python.org> wrote:
> Author: benjamin.peterson
> Date: Mon Jan 5 02:38:06 2009
> New Revision: 68335
>
> Log:
> employ a rather nasty hack to sort umlauts properly
>
> Modified:
> peps/trunk/pep0/pep.py
>
> Modified: peps/trunk/pep0/pep.py
> ==============================================================================
> --- peps/trunk/pep0/pep.py (original)
> +++ peps/trunk/pep0/pep.py Mon Jan 5 02:38:06 2009
> @@ -1,3 +1,4 @@
> +# -*- coding: utf-8 -*-
> """Code for handling object representation of a PEP."""
> import re
> import textwrap
> @@ -94,7 +95,9 @@
> break
> else:
> raise ValueError("last name missing a capital letter")
> - return u' '.join(name_parts[index:])
> + # This replace() hack is so people with an umlaut will sort in the right
> + # letter.
> + return u' '.join(name_parts[index:]).replace(u"ö", u"o")
FWIW, I think you could use the unicodedata module here to normalize
the names, so all kind of accented characters
can be replaced in the future:
import unicodedata
def _normalize(name):
return unicode(unicodedata.normalize('NFKD', name).encode('ASCII',
'ignore'))
>
> def _last_name(self, full_name):
> """Find the last name (or nickname) of a full name.
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>
--
Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/
More information about the Python-checkins
mailing list