From: Benoît Pin Date: Mon, 4 Jul 2011 09:40:11 +0000 (+0200) Subject: Affichage du nom de famille en majuscules (traitement des noms en unicode pour une... X-Git-Url: https://svn.cri.ensmp.fr/git/Plinn.git/commitdiff_plain/492bf0fb7e0204ec727c3639af6c5ea4006ef611 Affichage du nom de famille en majuscules (traitement des noms en unicode pour une capitalisation correcte des caractères accentués). --- diff --git a/utils.py b/utils.py index e867b0d..863b94e 100755 --- a/utils.py +++ b/utils.py @@ -87,15 +87,17 @@ def capitalizeCompoundGivenName(givenName) : def formatFullName(memberName, memberGivenName, memberId, nameBefore=1) : - memberFullName = '' + memberName = memberName.decode('utf-8') + memberGivenName = memberGivenName.decode('utf-8') + memberFullName = u'' if memberName and memberGivenName : if nameBefore : - memberFullName = memberName.capitalize() + ' ' + capitalizeCompoundGivenName(memberGivenName) + memberFullName = memberName.upper() + ' ' + capitalizeCompoundGivenName(memberGivenName) else : - memberFullName = capitalizeCompoundGivenName(memberGivenName) + ' ' + memberName.capitalize() + memberFullName = capitalizeCompoundGivenName(memberGivenName) + ' ' + memberName.upper() elif memberName and not memberGivenName : - memberFullName = memberName.capitalize() + memberFullName = memberName.upper() elif not memberName and memberGivenName : memberFullName = capitalizeCompoundGivenName(memberGivenName) @@ -103,7 +105,7 @@ def formatFullName(memberName, memberGivenName, memberId, nameBefore=1) : else : memberFullName = memberId - return memberFullName + return memberFullName.encode('utf-8') # from OFS.ObjectManager #63 bad_url_chars = re.compile(r'[^a-zA-Z0-9-_~,.$\(\)@]')