From d7855cf8d964ef651485ec3859688e8fb82ed8bb Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 24 Jan 2013 17:46:29 +0100 Subject: [PATCH] Use AuthRef for some client fields This tackles some TODO items left over. Change-Id: Ib062744acbf56f05d09857d244b78b35c0ef4d39 Signed-off-by: Julien Danjou --- keystoneclient/access.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/keystoneclient/access.py b/keystoneclient/access.py index 1dc86705..346315f9 100644 --- a/keystoneclient/access.py +++ b/keystoneclient/access.py @@ -18,7 +18,7 @@ import datetime from keystoneclient.openstack.common import timeutils - +from keystoneclient import service_catalog # gap, in seconds, to determine whether the given token is about to expire STALE_TOKEN_DURATION = 30 @@ -28,6 +28,14 @@ class AccessInfo(dict): """An object for encapsulating a raw authentication token from keystone and helper methods for extracting useful values from that token.""" + def __init__(self, *args, **kwargs): + super(AccessInfo, self).__init__(*args, **kwargs) + self.service_catalog = service_catalog.ServiceCatalog( + resource_dict=self, region_name=self.get('region_name')) + + def has_service_catalog(self): + return 'serviceCatalog' in self + def will_expire_soon(self, stale_duration=None): """ Determines if expiration is about to occur.