1
0
mirror of https://github.com/wting/autojump synced 2026-03-02 03:49:26 +00:00

Add Python 2.6 support back.

Closes #242.
This commit is contained in:
William Ting
2014-01-07 09:27:05 -06:00
parent 4bb6dfe1ca
commit 3f460fb3e9
11 changed files with 2385 additions and 19 deletions

View File

@@ -31,14 +31,16 @@ def create_dir(path):
def decode(string):
"""Converts byte string to Unicode string."""
if is_python2():
return string.decode('utf-8', errors='replace')
# Python 2.6 does not support kwargs
return string.decode('utf-8', 'replace')
return string
def encode(string):
"""Converts Unicode string to byte string."""
if is_python2():
return string.encode('utf-8', errors='replace')
# Python 2.6 does not support kwargs
return string.encode('utf-8', 'replace')
return string
@@ -192,8 +194,9 @@ def surround_quotes(string):
Bash has problems dealing with certain paths so we're surrounding all
path outputs with quotes.
"""
if in_bash():
return '"{}"'.format(string)
if in_bash() and string:
# Python 2.6 requres field numbers
return '"{0}"'.format(string)
return string