diff options
author | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-04-29 23:44:12 +0900 |
---|---|---|
committer | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-04-29 23:44:12 +0900 |
commit | 00eff0b7f656b5212b6f4d2c567f6828ee81ee82 (patch) | |
tree | c2c9028bcde9a51b75743a7b00d298da59e86e03 /sphinx/quickstart.py | |
parent | 91b9d75ac88afc349de4f8629b99c7fbcb3ff841 (diff) | |
download | sphinx-git-00eff0b7f656b5212b6f4d2c567f6828ee81ee82.tar.gz |
use six privided text_type() to replace with unicode() to support py2/py3 in one source. refs #1350.
Diffstat (limited to 'sphinx/quickstart.py')
-rw-r--r-- | sphinx/quickstart.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index f2ccb4e50..7117e3368 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -27,6 +27,7 @@ except ImportError: pass import six +from six import text_type from six.moves import input from docutils.utils import column_width @@ -1013,7 +1014,7 @@ def do_prompt(d, key, text, default=None, validator=nonempty): x = term_input(prompt).strip() if default and not x: x = default - if not isinstance(x, unicode): + if not isinstance(x, text_type): # for Python 2.x, try to get a Unicode string out of it if x.decode('ascii', 'replace').encode('ascii', 'replace') != x: if TERM_ENCODING: @@ -1239,10 +1240,10 @@ def generate(d, overwrite=True, silent=False): else: d['extensions'] = extensions d['copyright'] = time.strftime('%Y') + ', ' + d['author'] - d['author_texescaped'] = unicode(d['author']).\ + d['author_texescaped'] = text_type(d['author']).\ translate(texescape.tex_escape_map) d['project_doc'] = d['project'] + ' Documentation' - d['project_doc_texescaped'] = unicode(d['project'] + ' Documentation').\ + d['project_doc_texescaped'] = text_type(d['project'] + ' Documentation').\ translate(texescape.tex_escape_map) # escape backslashes and single quotes in strings that are put into |