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
c315efc0
Commit
c315efc0
authored
Apr 22, 2013
by
Giorgos Korfiatis
Browse files
astakos: Move helper function from qh to quotas.py
parent
83dfe64a
Changes
2
Show whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/quotas.py
View file @
c315efc0
...
@@ -103,8 +103,19 @@ def get_service_quotas(service, users=None):
...
@@ -103,8 +103,19 @@ def get_service_quotas(service, users=None):
return
transform_data
(
counters
)
return
transform_data
(
counters
)
def
_level_quota_dict
(
quotas
):
lst
=
[]
for
holder
,
holder_quota
in
quotas
.
iteritems
():
for
source
,
source_quota
in
holder_quota
.
iteritems
():
for
resource
,
limit
in
source_quota
.
iteritems
():
key
=
(
holder
,
source
,
resource
)
lst
.
append
((
key
,
limit
))
return
lst
def
set_user_quota
(
quotas
):
def
set_user_quota
(
quotas
):
qh
.
set_holder_quota
(
quotas
)
q
=
_level_quota_dict
(
quotas
)
qh
.
set_quota
(
q
)
def
get_default_quota
():
def
get_default_quota
():
...
...
snf-astakos-app/astakos/quotaholder/callpoint.py
View file @
c315efc0
...
@@ -106,19 +106,6 @@ class QuotaholderDjangoDBCallpoint(object):
...
@@ -106,19 +106,6 @@ class QuotaholderDjangoDBCallpoint(object):
'quantity'
:
quantity
,
'quantity'
:
quantity
,
}
}
def
set_holder_quota
(
self
,
quotas
):
q
=
self
.
_level_quota_dict
(
quotas
)
self
.
set_quota
(
q
)
def
_level_quota_dict
(
self
,
quotas
):
lst
=
[]
for
holder
,
holder_quota
in
quotas
.
iteritems
():
for
source
,
source_quota
in
holder_quota
.
iteritems
():
for
resource
,
limit
in
source_quota
.
iteritems
():
key
=
(
holder
,
source
,
resource
)
lst
.
append
((
key
,
limit
))
return
lst
def
set_quota
(
self
,
quotas
):
def
set_quota
(
self
,
quotas
):
holding_keys
=
[
key
for
(
key
,
limit
)
in
quotas
]
holding_keys
=
[
key
for
(
key
,
limit
)
in
quotas
]
holdings
=
self
.
_get_holdings_for_update
(
holding_keys
)
holdings
=
self
.
_get_holdings_for_update
(
holding_keys
)
...
...
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