Commit 06eccea2 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Remove list2str() (clients.utils) 4 simplicity

parent b4a7aa1f
......@@ -64,11 +64,11 @@ class Argument(object):
def __init__(self, arity, help=None, parsed_name=None, default=None):
self.arity = int(arity)
if help is not None:
if help:
self.help = help
if parsed_name is not None:
if parsed_name:
self.parsed_name = parsed_name
if default is not None:
if default:
self.default = default
@property
......@@ -353,7 +353,7 @@ class ProgressBarArgument(FlagArgument):
try:
KamakiProgressBar
except NameError:
kloger.warning('no progress bar functionality')
kloger.debug('WARNING: no progress bar functionality')
def clone(self):
"""Get a modifiable copy of this bar"""
......
......@@ -32,7 +32,7 @@
# or implied, of GRNET S.A.
from kamaki.clients.storage import StorageClient
from kamaki.clients.utils import path4url, list2str
from kamaki.clients.utils import path4url
class PithosRestAPI(StorageClient):
......@@ -275,7 +275,8 @@ class PithosRestAPI(StorageClient):
else:
self.set_param('path', path)
self.set_param('shared', iff=show_only_shared)
self.set_param('meta', list2str(meta), iff=meta)
print('la%sla' % 1 if meta else 2)
self.set_param('meta', ','.join(meta), iff=meta)
self.set_param('until', until, iff=until)
self.set_header('If-Modified-Since', if_modified_since)
......@@ -601,7 +602,7 @@ class PithosRestAPI(StorageClient):
perms += ';'
perms += '%s=%s' % (
permission_type,
list2str(permission_list, separator=','))
','.join(permission_list, separator=','))
self.set_header('X-Object-Sharing', perms)
self.set_header('X-Object-Public', public)
if metadata:
......@@ -697,7 +698,7 @@ class PithosRestAPI(StorageClient):
perms += ';'
perms += '%s=%s' % (
permission_type,
list2str(permission_list, separator=','))
','.join(permission_list, separator=','))
self.set_header('X-Object-Sharing', perms)
self.set_header('X-Object-Public', public)
if metadata:
......@@ -787,7 +788,7 @@ class PithosRestAPI(StorageClient):
perms += ';'
perms += '%s=%s' % (
permission_type,
list2str(permission_list, separator=','))
','.join(permission_list, separator=','))
self.set_header('X-Object-Sharing', perms)
self.set_header('X-Object-Public', public)
for key, val in metadata.items():
......@@ -902,7 +903,7 @@ class PithosRestAPI(StorageClient):
perms += ';'
perms += '%s=%s' % (
permission_type,
list2str(permission_list, separator=','))
','.join(permission_list, separator=','))
self.set_header('X-Object-Sharing', perms)
self.set_header('X-Object-Public', public)
for key, val in metadata.items():
......
......@@ -118,21 +118,3 @@ def params4url(params):
result += '=%s' % params[name] if params[name] else result
dlmtr = '&'
return result
def list2str(alist, separator=','):
"""[val1, val2, val3] --> "val1,val2,val3"
:param separator: (str)
:returns: (str) all list elements separated by separator
"""
ret = ''
slist = sorted(alist)
for item in slist:
if 0 == slist.index(item):
ret = unicode(item)
else:
ret += separator + unicode(item)
return ret
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