Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
06eccea2
Commit
06eccea2
authored
Feb 13, 2013
by
Stavros Sachtouris
Browse files
Remove list2str() (clients.utils) 4 simplicity
parent
b4a7aa1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/argument.py
View file @
06eccea2
...
...
@@ -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"""
...
...
kamaki/clients/pithos_rest_api.py
View file @
06eccea2
...
...
@@ -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
():
...
...
kamaki/clients/utils.py
View file @
06eccea2
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment