Commit 1e5a0c88 authored by Jérome Perrin's avatar Jérome Perrin

fixup! bearer_token: py3

parent 109370d4
...@@ -6,7 +6,7 @@ import six ...@@ -6,7 +6,7 @@ import six
CACHE_FACTORY_NAME = 'bearer_token_cache_factory' CACHE_FACTORY_NAME = 'bearer_token_cache_factory'
def getHMAC(self, key, body): def getHMAC(self, key, body):
# type: (bytes, bytes) -> str # type: (erp5.portal_type.Base, bytes, bytes) -> str
digest = hmac.new(key, body, digestmod=hashlib.md5) digest = hmac.new(key, body, digestmod=hashlib.md5)
return digest.hexdigest() return digest.hexdigest()
...@@ -24,7 +24,7 @@ def _getCacheFactory(self, cache_factory_name): ...@@ -24,7 +24,7 @@ def _getCacheFactory(self, cache_factory_name):
return cache_tool.getRamCacheRoot().get(cache_factory_name) return cache_tool.getRamCacheRoot().get(cache_factory_name)
def setBearerToken(self, key, body, cache_factory_name=CACHE_FACTORY_NAME): def setBearerToken(self, key, body, cache_factory_name=CACHE_FACTORY_NAME):
# type: (str, Any, str) -> None # type: (erp5.portal_type.Base, str, Any, str) -> None
if not isinstance(key, six.string_types): if not isinstance(key, six.string_types):
__traceback_info__ = key __traceback_info__ = key
raise TypeError("Wrong key type %s" % (type(key))) raise TypeError("Wrong key type %s" % (type(key)))
...@@ -35,7 +35,7 @@ def setBearerToken(self, key, body, cache_factory_name=CACHE_FACTORY_NAME): ...@@ -35,7 +35,7 @@ def setBearerToken(self, key, body, cache_factory_name=CACHE_FACTORY_NAME):
body, cache_duration=cache_duration) body, cache_duration=cache_duration)
def getBearerToken(self, key, cache_factory_name=CACHE_FACTORY_NAME): def getBearerToken(self, key, cache_factory_name=CACHE_FACTORY_NAME):
# type: (str, Any, str) -> None # type: (erp5.portal_type.Base, str, str) -> Any
assert isinstance(key, six.string_types) assert isinstance(key, six.string_types)
cache_factory = _getCacheFactory(self, cache_factory_name) cache_factory = _getCacheFactory(self, cache_factory_name)
for cache_plugin in cache_factory.getCachePluginList(): for cache_plugin in cache_factory.getCachePluginList():
......
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