fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Missing logos.
[wolnelektury.git]
/
src
/
api
/
request_validator.py
diff --git
a/src/api/request_validator.py
b/src/api/request_validator.py
index
690d3e9
..
78834ff
100644
(file)
--- a/
src/api/request_validator.py
+++ b/
src/api/request_validator.py
@@
-1,5
+1,5
@@
-# This file is part of Wolne
l
ektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja
Nowoczesna Polska
. See NOTICE for more information.
+# This file is part of Wolne
L
ektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja
Wolne Lektury
. See NOTICE for more information.
#
import time
from oauthlib.oauth1 import RequestValidator
#
import time
from oauthlib.oauth1 import RequestValidator
@@
-32,7
+32,17
@@
class PistonRequestValidator(RequestValidator):
return request.token.secret
def get_access_token_secret(self, client_key, token, request):
return request.token.secret
def get_access_token_secret(self, client_key, token, request):
- return request.token.secret
+ if request.token:
+ return request.token.secret
+ else:
+ try:
+ token = Token.objects.get(
+ token_type=Token.ACCESS,
+ consumer__key=client_key,
+ key=token
+ )
+ except: return None
+ return token.secret
def get_default_realms(self, client_key, request):
return ['API']
def get_default_realms(self, client_key, request):
return ['API']