Set default value for new token attributes

Two new attributes were recently added to token object:
'unscoped_token' and 'is_federated'. When performing an
upgrade, the existing token object stored in the session
will not have the two attributes yet.  This patch fixes
the issue by providing a default value so it won't interrupt
service for existing login user during an upgrade.

Change-Id: I6adf974876294168e2326b5e10c14da2dd3e52ea
Closes-bug: #1451934
This commit is contained in:
lin-hua-cheng
2015-05-05 10:07:45 -07:00
parent ec884cf902
commit d8f5c949df

View File

@@ -55,8 +55,9 @@ def create_user_from_token(request, token, endpoint, services_region=None):
roles=token.roles,
endpoint=endpoint,
services_region=svc_region,
is_federated=token.is_federated,
unscoped_token=token.unscoped_token)
is_federated=getattr(token, 'is_federated', False),
unscoped_token=getattr(token, 'unscoped_token',
request.session.get('unscoped_token')))
class Token(object):