From 8d61f68ee3e9449a7c8ce85780e679a9f5312861 Mon Sep 17 00:00:00 2001 From: asteroide Date: Thu, 10 Sep 2015 09:41:16 +0200 Subject: get_aggregation_algorithm_dict now return an empty dictionnary if algorithm is not found. Change-Id: I53d821ea88958e53ba72467f44251fabcc1ae55e --- keystone-moon/keystone/contrib/moon/backends/sql.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'keystone-moon/keystone/contrib') diff --git a/keystone-moon/keystone/contrib/moon/backends/sql.py b/keystone-moon/keystone/contrib/moon/backends/sql.py index 7cbbd4c0..f08038a2 100644 --- a/keystone-moon/keystone/contrib/moon/backends/sql.py +++ b/keystone-moon/keystone/contrib/moon/backends/sql.py @@ -892,7 +892,10 @@ class IntraExtensionConnector(IntraExtensionDriver): query = session.query(AggregationAlgorithm) query = query.filter_by(intra_extension_id=intra_extension_id) ref = query.first() - return {ref.id: ref.aggregation_algorithm} + try: + return {ref.id: ref.aggregation_algorithm} + except AttributeError: + return {} def set_aggregation_algorithm_dict(self, intra_extension_id, aggregation_algorithm_id, aggregation_algorithm_dict): with sql.transaction() as session: -- cgit 1.2.3-korg