Revision a517ff50
b/kamaki/cli/argument.py | ||
---|---|---|
83 | 83 |
if isinstance(newname, list) or isinstance(newname, tuple): |
84 | 84 |
self._parsed_name += list(newname) |
85 | 85 |
else: |
86 |
self._parsed_name.append(unicode(newname))
|
|
86 |
self._parsed_name.append('%s' % newname)
|
|
87 | 87 |
|
88 | 88 |
@property |
89 | 89 |
def help(self): |
... | ... | |
92 | 92 |
|
93 | 93 |
@help.setter |
94 | 94 |
def help(self, newhelp): |
95 |
self._help = unicode(newhelp)
|
|
95 |
self._help = '%s' % newhelp
|
|
96 | 96 |
|
97 | 97 |
@property |
98 | 98 |
def arity(self): |
... | ... | |
189 | 189 |
if options == self.default: |
190 | 190 |
return |
191 | 191 |
if not isinstance(options, list): |
192 |
options = [unicode(options)]
|
|
192 |
options = ['%s' % options]
|
|
193 | 193 |
for option in options: |
194 | 194 |
keypath, sep, val = option.partition('=') |
195 | 195 |
if not sep: |
b/kamaki/cli/commands/cyclades_cli.py | ||
---|---|---|
353 | 353 |
def _run(self, server_id, profile): |
354 | 354 |
self.client.set_firewall_profile( |
355 | 355 |
server_id=int(server_id), |
356 |
profile=unicode(profile).upper())
|
|
356 |
profile=('%s' % profile).upper())
|
|
357 | 357 |
|
358 | 358 |
def main(self, server_id, profile): |
359 | 359 |
super(self.__class__, self)._run() |
b/kamaki/cli/errors.py | ||
---|---|---|
113 | 113 |
else: |
114 | 114 |
origerr = stack[0] |
115 | 115 |
|
116 |
message = unicode(message) if message else unicode(origerr)
|
|
116 |
message = '%s' % (message if message else origerr)
|
|
117 | 117 |
|
118 | 118 |
try: |
119 | 119 |
status = err.status or err.errno |
b/kamaki/cli/utils.py | ||
---|---|---|
99 | 99 |
|
100 | 100 |
counter = 1 |
101 | 101 |
for key, val in sorted(d.items()): |
102 |
key = '%s' % key |
|
102 | 103 |
if key in exclude: |
103 | 104 |
continue |
104 | 105 |
print_str = '' |
... | ... | |
106 | 107 |
print_str = '%s. ' % counter |
107 | 108 |
counter += 1 |
108 | 109 |
print_str = '%s%s' % (' ' * (ident - len(print_str)), print_str) |
109 |
print_str += ('%s' % key).strip()
|
|
110 |
print_str += ' ' * (margin - len(unicode(key).strip()))
|
|
110 |
print_str += key.strip()
|
|
111 |
print_str += ' ' * (margin - len(key.strip()))
|
|
111 | 112 |
print_str += ': ' |
112 | 113 |
if isinstance(val, dict): |
113 | 114 |
print(print_str) |
... | ... | |
126 | 127 |
with_enumeration=recursive_enumeration, |
127 | 128 |
recursive_enumeration=recursive_enumeration) |
128 | 129 |
else: |
129 |
print print_str + ' ' + unicode(val).strip()
|
|
130 |
print print_str + ' ' + ('%s' % val).strip()
|
|
130 | 131 |
|
131 | 132 |
|
132 | 133 |
def print_list( |
... | ... | |
158 | 159 |
isinstance(item, list) or |
159 | 160 |
item in exclude)) |
160 | 161 |
except ValueError: |
161 |
margin = (2 + len(unicode(len(l)))) if enumerate else 1
|
|
162 |
margin = (2 + len(('%s' % len(l)))) if enumerate else 1
|
|
162 | 163 |
|
163 | 164 |
counter = 1 |
164 | 165 |
prefix = '' |
... | ... | |
242 | 243 |
if isinstance(item, dict): |
243 | 244 |
title = sorted(set(title).intersection(item.keys())) |
244 | 245 |
if with_redundancy: |
245 |
header = ' '.join(unicode(item[key]) for key in title)
|
|
246 |
header = ' '.join('%s' % item[key] for key in title)
|
|
246 | 247 |
else: |
247 |
header = ' '.join(unicode(item.pop(key)) for key in title)
|
|
248 |
header = ' '.join('%s' % item.pop(key) for key in title)
|
|
248 | 249 |
print(bold(header)) |
249 | 250 |
if isinstance(item, dict): |
250 | 251 |
print_dict(item, ident=1) |
... | ... | |
305 | 306 |
f.write('\n') |
306 | 307 |
list2file(v, f, depth + 1) |
307 | 308 |
else: |
308 |
f.write(' %s\n' % unicode(v))
|
|
309 |
f.write(' %s\n' % v)
|
|
309 | 310 |
|
310 | 311 |
|
311 | 312 |
def list2file(l, f, depth=1): |
... | ... | |
315 | 316 |
elif isinstance(item, list): |
316 | 317 |
list2file(item, f, depth + 1) |
317 | 318 |
else: |
318 |
f.write('%s%s\n' % ('\t' * depth, unicode(item)))
|
|
319 |
f.write('%s%s\n' % ('\t' * depth, item))
|
|
319 | 320 |
|
320 | 321 |
# Split input auxiliary |
321 | 322 |
|
b/kamaki/clients/__init__.py | ||
---|---|---|
189 | 189 |
data = dumps(kwargs.pop('json')) |
190 | 190 |
self.set_default_header('Content-Type', 'application/json') |
191 | 191 |
if data: |
192 |
self.set_default_header('Content-Length', unicode(len(data)))
|
|
192 |
self.set_default_header('Content-Length', '%s' % len(data))
|
|
193 | 193 |
|
194 | 194 |
sendlog.info('perform a %s @ %s', method, self.base_url) |
195 | 195 |
|
b/kamaki/clients/compute.py | ||
---|---|---|
101 | 101 |
if isinstance(err.details, list): |
102 | 102 |
tmp_err = err.details |
103 | 103 |
else: |
104 |
tmp_err = unicode(err.details).split(',') |
|
104 |
errd = '%s' % err.details |
|
105 |
tmp_err = errd.split(',') |
|
105 | 106 |
tmp_err = tmp_err[0].split(':') |
106 | 107 |
tmp_err = tmp_err[2].split('"') |
107 | 108 |
err.message = tmp_err[1] |
b/kamaki/clients/connection/__init__.py | ||
---|---|---|
144 | 144 |
self.method = method |
145 | 145 |
|
146 | 146 |
def set_header(self, name, value): |
147 |
self.headers[unicode(name)] = unicode(value)
|
|
147 |
self.headers['%s' % name] = '%s' % value
|
|
148 | 148 |
|
149 | 149 |
def remove_header(self, name): |
150 | 150 |
try: |
b/kamaki/clients/connection/kamakicon.py | ||
---|---|---|
74 | 74 |
:returns: (str) content |
75 | 75 |
""" |
76 | 76 |
self._get_response() |
77 |
return unicode(self._content)
|
|
77 |
return '%s' % self._content
|
|
78 | 78 |
|
79 | 79 |
@text.setter |
80 | 80 |
def test(self, v): |
... | ... | |
123 | 123 |
for k, v in extra_params.items(): |
124 | 124 |
params[k] = v |
125 | 125 |
for i, (key, val) in enumerate(params.items()): |
126 |
param_str = ('?' if i == 0 else '&') + unicode(key)
|
|
126 |
param_str = '%s%s' % ('?' if i == 0 else '&', key)
|
|
127 | 127 |
if val is not None: |
128 |
param_str += '=' + unicode(val)
|
|
128 |
param_str += '=%s' % val
|
|
129 | 129 |
url += param_str |
130 | 130 |
|
131 | 131 |
parsed = urlparse(url) |
b/kamaki/clients/cyclades.py | ||
---|---|---|
229 | 229 |
for (nic_id, network_id) in [( |
230 | 230 |
net['id'], |
231 | 231 |
net['network_id']) for net in vm_nets if nic_id == net['id']]: |
232 |
req = {'remove': {'attachment': unicode(nic_id)}}
|
|
232 |
req = {'remove': {'attachment': '%s' % nic_id}}
|
|
233 | 233 |
r = self.networks_post(network_id, 'action', json_data=req) |
234 | 234 |
r.release() |
235 | 235 |
num_of_disconnections += 1 |
b/kamaki/clients/utils.py | ||
---|---|---|
89 | 89 |
|
90 | 90 |
path = '' |
91 | 91 |
for arg in args: |
92 |
suffix = unicode(arg)
|
|
92 |
suffix = '%s' % arg
|
|
93 | 93 |
try: |
94 | 94 |
while suffix[0] == '/': |
95 | 95 |
suffix = suffix[1:] |
Also available in: Unified diff