mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Merge lp:~lool/ubuntu-dev-tools/fix-non-ascii-name; ubuntutools.config: decode
developer names with the current locale's encoding and add corresponding test; fixes handling of non-ascii names.
This commit is contained in:
commit
ef37995a71
5
debian/changelog
vendored
5
debian/changelog
vendored
@ -1,7 +1,12 @@
|
||||
ubuntu-dev-tools (0.149) UNRELEASED; urgency=low
|
||||
|
||||
[ Marc Deslauriers ]
|
||||
* mk-sbuild: allow specifying the schroot profile.
|
||||
|
||||
[ Loïc Minier ]
|
||||
* ubuntutools.config: decode developer names with the current locale's
|
||||
encoding and add corresponding test; fixes handling of non-ascii names.
|
||||
|
||||
-- Marc Deslauriers <marc.deslauriers@ubuntu.com> Mon, 06 May 2013 09:43:02 -0400
|
||||
|
||||
ubuntu-dev-tools (0.148) unstable; urgency=low
|
||||
|
@ -21,6 +21,7 @@ import re
|
||||
import shlex
|
||||
import socket
|
||||
import sys
|
||||
import locale
|
||||
|
||||
from ubuntutools.logger import Logger
|
||||
|
||||
@ -173,4 +174,10 @@ def ubu_email(name=None, email=None, export=True):
|
||||
if export:
|
||||
os.environ['DEBFULLNAME'] = name
|
||||
os.environ['DEBEMAIL'] = email
|
||||
|
||||
# decode env var or gecos raw string with the current locale's encoding
|
||||
encoding = locale.getdefaultlocale()[1]
|
||||
if not encoding:
|
||||
encoding = 'utf-8'
|
||||
name = name.decode(encoding)
|
||||
return name, email
|
||||
|
@ -1,4 +1,5 @@
|
||||
# test_config.py - Test suite for ubuntutools.config
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2010, Stefano Rivera <stefanor@ubuntu.com>
|
||||
#
|
||||
@ -17,6 +18,7 @@
|
||||
import __builtin__
|
||||
import os
|
||||
import sys
|
||||
import locale
|
||||
from StringIO import StringIO
|
||||
|
||||
import mox
|
||||
@ -210,3 +212,12 @@ class UbuEmailTestCase(unittest.TestCase):
|
||||
os.environ['DEBEMAIL'] = orig = '%s <%s>' % (name, email)
|
||||
self.assertEqual(ubu_email(), (name, email))
|
||||
self.assertEqual(os.environ['DEBEMAIL'], orig)
|
||||
|
||||
def test_unicode_name(self):
|
||||
encoding = locale.getdefaultlocale()[1]
|
||||
if not encoding:
|
||||
encoding = 'utf-8'
|
||||
name = 'Jöe Déveloper'.decode('utf-8')
|
||||
os.environ['DEBFULLNAME'] = name.encode(encoding)
|
||||
os.environ['DEBEMAIL'] = email = 'joe@example.net'
|
||||
self.assertEqual(ubu_email(), (name, email))
|
||||
|
Loading…
x
Reference in New Issue
Block a user