Commit a5b748c2 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Fix Pithos calls unicode bug

parent 7a3c66e1
......@@ -98,14 +98,14 @@ class _command_init(object):
self.cloud = cloud or getattr(self, 'cloud', None)
def write(self, s):
self._out.write(u'%s' % s)
self._out.write('%s' % s)
self._out.flush()
def writeln(self, s=''):
self.write(u'%s\n' % s)
self.write('%s\n' % s)
def error(self, s=''):
self._err.write(u'%s\n' % s)
self._err.write('%s\n' % s)
self._err.flush()
def print_list(self, *args, **kwargs):
......
......@@ -166,7 +166,7 @@ def print_dict(
v, exclude, indent + INDENT_TAB,
recursive_enumeration, recursive_enumeration, out)
else:
out.write(u'%s %s\n' % (print_str, v))
out.write('%s %s\n' % (print_str, v))
out.flush()
......@@ -214,7 +214,7 @@ def print_list(
if with_enumeration:
out.write(print_str + '\n')
elif i and i < len(l):
out.write(u'\n')
out.write('\n')
print_list(
item, exclude, indent + INDENT_TAB,
recursive_enumeration, recursive_enumeration, out)
......@@ -222,7 +222,7 @@ def print_list(
item = ('%s' % item).strip()
if item in exclude:
continue
out.write(u'%s%s\n' % (print_str, item))
out.write('%s%s\n' % (print_str, item))
out.flush()
out.flush()
......@@ -247,24 +247,24 @@ def print_items(
return
if not (isinstance(items, dict) or isinstance(items, list) or isinstance(
items, tuple)):
out.write(u'%s\n' % items)
out.write('%s\n' % items)
out.flush()
return
for i, item in enumerate(items):
if with_enumeration:
out.write(u'%s. ' % (i + 1))
out.write('%s. ' % (i + 1))
if isinstance(item, dict):
item = dict(item)
title = sorted(set(title).intersection(item))
pick = item.get if with_redundancy else item.pop
header = u' '.join(u'%s' % pick(key) for key in title)
header = ' '.join('%s' % pick(key) for key in title)
out.write((unicode(bold(header) if header else '') + '\n'))
print_dict(item, indent=INDENT_TAB, out=out)
elif isinstance(item, list) or isinstance(item, tuple):
print_list(item, indent=INDENT_TAB, out=out)
else:
out.write(u' %s\n' % item)
out.write(' %s\n' % item)
out.flush()
out.flush()
......@@ -389,7 +389,7 @@ def ask_user(msg, true_resp=('y', ), out=stdout, user_in=stdin):
"""
yep = ', '.join(true_resp)
nope = '<not %s>' % yep if 'n' in true_resp or 'N' in true_resp else 'N'
out.write(u'%s [%s/%s]: ' % (msg, yep, nope))
out.write('%s [%s/%s]: ' % (msg, yep, nope))
out.flush()
user_response = user_in.readline()
return user_response[0].lower() in [s.lower() for s in true_resp]
......
......@@ -123,7 +123,7 @@ class RequestManager(Logged):
url += _encode(path[1:] if path.startswith('/') else path)
delim = '?'
for key, val in params.items():
val = '' if val in (None, False) else _encode(u'%s' % val)
val = '' if val in (None, False) else _encode('%s' % val)
url += '%s%s%s' % (delim, key, ('=%s' % val) if val else '')
delim = '&'
parsed = urlparse(url)
......@@ -421,7 +421,7 @@ class Client(Logged):
def set_param(self, name, value=None, iff=True):
if iff:
self.params[name] = unicode(value)
self.params[name] = '%s' % value # unicode(value)
def request(
self, method, path,
......
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