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
synnefo
Commits
583d0ee1
Commit
583d0ee1
authored
Dec 11, 2013
by
Sofia Papagiannaki
Browse files
pithos: Further code refactoring in _list_objects()
parent
e7c56937
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-pithos-backend/pithos/backends/modular.py
View file @
583d0ee1
...
...
@@ -723,15 +723,16 @@ class ModularBackend(BaseBackend):
size_range
,
all_props
,
public
):
if
user
!=
account
and
until
:
raise
NotAllowedError
objects
=
[]
if
shared
and
public
:
# get shared first
shared_paths
=
self
.
_list_object_permissions
(
user
,
account
,
container
,
prefix
,
shared
=
True
,
public
=
False
)
objects
=
set
()
if
shared_paths
:
path
,
node
=
self
.
_lookup_container
(
account
,
container
)
shared_paths
=
self
.
_get_formatted_paths
(
shared_paths
)
objects
|
=
set
(
self
.
_list_object_properties
(
objects
=
set
(
self
.
_list_object_properties
(
node
,
path
,
prefix
,
delimiter
,
marker
,
limit
,
virtual
,
domain
,
keys
,
until
,
size_range
,
shared_paths
,
all_props
))
...
...
@@ -741,27 +742,22 @@ class ModularBackend(BaseBackend):
objects
=
list
(
objects
)
objects
.
sort
(
key
=
lambda
x
:
x
[
0
])
start
,
limit
=
self
.
_list_limits
(
[
x
[
0
]
for
x
in
objects
],
marker
,
limit
)
return
objects
[
start
:
start
+
limit
]
elif
public
:
objects
=
self
.
_list_public_object_properties
(
user
,
account
,
container
,
prefix
,
all_props
)
start
,
limit
=
self
.
_list_limits
(
[
x
[
0
]
for
x
in
objects
],
marker
,
limit
)
return
objects
[
start
:
start
+
limit
]
else
:
allowed
=
self
.
_list_object_permissions
(
user
,
account
,
container
,
prefix
,
shared
,
public
=
False
)
if
shared
and
not
allowed
:
return
[]
path
,
node
=
self
.
_lookup_container
(
account
,
container
)
allowed
=
self
.
_get_formatted_paths
(
allowed
)
objects
=
self
.
_list_object_properties
(
node
,
path
,
prefix
,
delimiter
,
marker
,
limit
,
virtual
,
domain
,
keys
,
until
,
size_range
,
allowed
,
all_props
)
allowed
=
self
.
_list_object_permissions
(
user
,
account
,
container
,
prefix
,
shared
,
public
)
if
shared
and
not
allowed
:
return
[]
path
,
node
=
self
.
_lookup_container
(
account
,
container
)
allowed
=
self
.
_get_formatted_paths
(
allowed
)
objects
=
self
.
_list_object_properties
(
node
,
path
,
prefix
,
delimiter
,
marker
,
limit
,
virtual
,
domain
,
keys
,
until
,
size_range
,
allowed
,
all_props
)
start
,
limit
=
self
.
_list_limits
(
[
x
[
0
]
for
x
in
objects
],
marker
,
limit
)
# apply limits
start
,
limit
=
self
.
_list_limits
(
objects
,
marker
,
limit
)
return
objects
[
start
:
start
+
limit
]
def
_list_public_object_properties
(
self
,
user
,
account
,
container
,
prefix
,
...
...
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