From 569d69017a3a10a50e2f0096c4d865c5ab4f0e35 Mon Sep 17 00:00:00 2001 From: Phil Hachey Date: Mon, 12 Feb 2018 13:00:01 -0400 Subject: [PATCH] Updated Configuration to be a new-style class --- .gitignore | 1 + aws_google_auth/configuration.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index ba78328..e2f5f6a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .eggs/ *.pyc dist +build/ diff --git a/aws_google_auth/configuration.py b/aws_google_auth/configuration.py index d2debc2..ce02aa3 100644 --- a/aws_google_auth/configuration.py +++ b/aws_google_auth/configuration.py @@ -11,7 +11,7 @@ from . import amazon -class Configuration: +class Configuration(object): def __init__(self, **kwargs): self.options = {} @@ -69,16 +69,17 @@ def ensure_config_files_exist(self): # Will return a SAML cache, ONLY if it's valid. If invalid or not set, will # return None. If the SAML cache isn't valid, we'll remove it from the # in-memory object. On the next write(), it will be purged from disk. - def saml_cache_reader(self): + @property + def saml_cache(self): if not amazon.Amazon.is_valid_saml_assertion(self.__saml_cache): self.__saml_cache = None + return self.__saml_cache - def saml_cache_writer(self, value): + @saml_cache.setter + def saml_cache(self, value): self.__saml_cache = value - saml_cache = property(saml_cache_reader, saml_cache_writer) - # Will raise exceptions if the configuration is invalid, otherwise returns # None. Use this at any point to validate the configuration is in a good # state. There are no checks here regarding SAML caching, as that's just a