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
68b5beb0
Commit
68b5beb0
authored
Nov 16, 2012
by
Giorgos Korfiatis
Browse files
Do not allow duplicate provisions in a commission.
parent
d41707ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
snf-common/synnefo/lib/quotaholder/api/__init__.py
View file @
68b5beb0
...
...
@@ -35,6 +35,7 @@ from .quotaholder import QuotaholderAPI
from
.exception
import
(
InvalidKeyError
,
NoEntityError
,
NoQuantityError
,
NoCapacityError
,
ExportLimitError
,
ImportLimitError
,
CorruptedError
,
InvalidDataError
)
CorruptedError
,
InvalidDataError
,
DuplicateError
)
API_Spec
=
QuotaholderAPI
snf-common/synnefo/lib/quotaholder/api/exception.py
View file @
68b5beb0
...
...
@@ -61,3 +61,7 @@ class ExportLimitError(CommissionException):
@
register_exception
class
ImportLimitError
(
CommissionException
):
pass
@
register_exception
class
DuplicateError
(
CommissionException
):
pass
snf-quotaholder-app/quotaholder_django/quotaholder_app/callpoint.py
View file @
68b5beb0
...
...
@@ -35,7 +35,8 @@ from synnefo.lib.quotaholder.api import (
QuotaholderAPI
,
InvalidKeyError
,
NoEntityError
,
NoQuantityError
,
NoCapacityError
,
ExportLimitError
,
ImportLimitError
)
ExportLimitError
,
ImportLimitError
,
DuplicateError
)
from
synnefo.lib.commissioning
import
\
Callpoint
,
CorruptedError
,
InvalidDataError
...
...
@@ -349,7 +350,15 @@ class QuotaholderDjangoDBCallpoint(Callpoint):
commission
=
create
(
entity_id
=
target
,
clientkey
=
clientkey
,
name
=
name
)
serial
=
commission
.
serial
checked
=
[]
for
entity
,
resource
,
quantity
in
provisions
:
ent_res
=
entity
,
resource
if
ent_res
in
checked
:
m
=
"Duplicate provision for %s.%s"
%
ent_res
raise
DuplicateError
(
m
)
checked
.
append
(
ent_res
)
try
:
e
=
Entity
.
objects
.
get
(
entity
=
entity
)
except
Entity
.
DoesNotExist
:
...
...
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