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
5ff5b2d0
Commit
5ff5b2d0
authored
Apr 10, 2013
by
Ilias Tsitsimpis
Browse files
snf-django-lib: ReRaise AstakosClientExceptions as API Faults
parent
887fdf6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-django-lib/snf_django/lib/api/__init__.py
View file @
5ff5b2d0
...
...
@@ -43,6 +43,7 @@ from django.utils import simplejson as json
from
django.template.loader
import
render_to_string
from
astakosclient
import
AstakosClient
from
astakosclient.errors
import
AstakosClientException
from
django.conf
import
settings
from
snf_django.lib.api
import
faults
...
...
@@ -88,10 +89,15 @@ def api_method(http_method=None, token_required=True, user_required=True,
# Authenticate
if
user_required
:
assert
(
token_required
),
"Can not get user without token"
astakos
=
AstakosClient
(
settings
.
ASTAKOS_URL
,
use_pool
=
True
,
logger
=
logger
)
user_info
=
astakos
.
get_user_info
(
token
)
try
:
astakos
=
AstakosClient
(
settings
.
ASTAKOS_URL
,
use_pool
=
True
,
logger
=
logger
)
user_info
=
astakos
.
get_user_info
(
token
)
except
AstakosClientException
as
err
:
raise
faults
.
Fault
(
message
=
err
.
message
,
details
=
err
.
details
,
code
=
err
.
status
)
request
.
user_uniq
=
user_info
[
"uuid"
]
request
.
user
=
user_info
...
...
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