Commit ede3a09e authored by Arnaud Fontaine's avatar Arnaud Fontaine

2to3: Upstream itools does not support python3.

parent e2e2de5a
......@@ -17,13 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Import from itools
from accept import AcceptLanguageType, get_accept, select_language
from accept import init_language_selector
from fuzzy import get_distance, get_similarity, is_similar, get_most_similar
from languages import has_language, get_languages, get_language_name
from locale_ import format_date, format_time, format_datetime
from locale_ import format_number
from oracle import guess_language, is_asian_character, is_punctuation
from __future__ import absolute_import
from .accept import AcceptLanguageType, get_accept, select_language
from .accept import init_language_selector
from .fuzzy import get_distance, get_similarity, is_similar, get_most_similar
from .languages import has_language, get_languages, get_language_name
from .locale_ import format_date, format_time, format_datetime
from .locale_ import format_number
from .oracle import guess_language, is_asian_character, is_punctuation
......
......@@ -20,7 +20,7 @@ protocol.
"""
# Import from the Standard Library
import __builtin__
import builtins
from decimal import Decimal
from locale import getdefaultlocale
......@@ -160,7 +160,7 @@ def select_language(languages=None):
def init_language_selector(language_selector=select_language):
__builtin__.__dict__['select_language'] = language_selector
builtins.__dict__['select_language'] = language_selector
# Set default language selector
......
......@@ -18,12 +18,13 @@
"""
Output dates and times in locale format.
"""
from __future__ import absolute_import
# Import from the Standard Library
from decimal import Decimal
# Import from itools
from accept import get_accept
from .accept import get_accept
def get_format(source, accept):
......@@ -32,7 +33,7 @@ def get_format(source, accept):
accept = get_accept()
# Negotiate
available_languages = source.keys()
available_languages = list(source.keys())
language = accept.select_language(available_languages)
if language is None:
language = 'en'
......@@ -97,7 +98,8 @@ def moneyfmt(value, places=2, curr=u'', sep=u',', dp=u'.', pos=u'',
q = Decimal(10) ** -places # 2 places --> '0.01'
sign, digits, exp = value.quantize(q).as_tuple()
result = []
digits = map(unicode, digits)
import six
digits = [six.text_type(d) for d in digits]
build, next = result.append, digits.pop
if curr:
build(curr)
......
......@@ -99,6 +99,6 @@ def get_pipe(command, cwd=None):
popen = Popen(command, stdout=PIPE, stderr=PIPE, cwd=cwd)
stdoutdata, stderrdata = popen.communicate()
if popen.returncode != 0:
raise EnvironmentError, (popen.returncode, stderrdata)
raise EnvironmentError(popen.returncode, stderrdata)
return stdoutdata
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment