Commit 200b9bff authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos: Fix view issue with unicode paths

parent 8d33eb7a
......@@ -124,7 +124,7 @@ class AuthorizationCode(models.Model):
def __repr__(self):
return ("Authorization code: %s "
"(user: %s, client: %s, redirect_uri: %s, scope: %s)" % (
"(user: %r, client: %r, redirect_uri: %r, scope: %r)" % (
self.code,
self.user.log_display,
self.client.get_id(),
......@@ -152,7 +152,7 @@ class Token(models.Model):
state = models.TextField(null=True, default=None)
def __repr__(self):
return ("Token: %s (token_type: %s, grant_type: %s, "
"user: %s, client: %s, scope: %s)" % (
return ("Token: %r (token_type: %r, grant_type: %r, "
"user: %r, client: %r, scope: %r)" % (
self.code, self.token_type, self.grant_type,
self.user.log_display, self.client.get_id(), self.scope))
......@@ -75,6 +75,7 @@ from pithos.backends.base import (NotAllowedError, QuotaError, ItemNotExists,
VersionNotExists)
from synnefo.lib import join_urls
from synnefo.util import text
from astakosclient import AstakosClient
from astakosclient.errors import NoUserName, NoUUID, AstakosClientException
......@@ -1173,7 +1174,8 @@ def view_method():
try:
access_token = request.GET.get('access_token')
requested_resource = request.path.split(VIEW_PREFIX, 2)[-1]
requested_resource = text.uenc(request.path.split(VIEW_PREFIX,
2)[-1])
astakos = AstakosClient(SERVICE_TOKEN, ASTAKOS_AUTH_URL,
retry=2, use_pool=True,
logger=logger)
......@@ -1205,7 +1207,7 @@ def view_method():
'redirect_uri':
request.build_absolute_uri(request.path),
'state': '', # TODO include state for security
'scope': request.path.split(VIEW_PREFIX, 2)[-1]}
'scope': requested_resource}
return HttpResponseRedirect('%s?%s' %
(join_urls(astakos.oauth2_url,
'auth'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment