Last active
August 29, 2015 14:26
-
-
Save yottatsa/5b83aeda42e60e0afd68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_token(self, token): | |
"""Validates a Fernet token and returns the payload attributes.""" | |
# Convert v2 unicode token to a string | |
if not isinstance(token, six.binary_type): | |
token = token.encode('ascii') | |
#to | |
def validate_token(self, token): | |
"""Validates a Fernet token and returns the payload attributes.""" | |
# Convert v2 unicode token to a string | |
if isinstance(token, six.text_type): | |
token = token.encode('ascii') | |
if not isinstance(token, six.binary_type): | |
raise exception.ValidationError(_('This is not a recognized Fernet token')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For https://review.openstack.org/#/c/206921/