Simpler quota check matching

This commit is contained in:
Juan Ignacio Sánchez Lara
2018-04-11 12:14:11 +02:00
parent e5d2182da3
commit c3c28dfd5e
@@ -69,31 +69,16 @@ class QuotaChecker:
def check(self): def check(self):
""" Check if the current user quota surpasses the current quota """ """ Check if the current user quota surpasses the current quota """
if re.match('geocoder_*', if re.match('^geocoder_',
self._user_service_config.service_type) is not None: self._user_service_config.service_type) is not None:
return self.__check_geocoder_quota() return self.__check_geocoder_quota()
elif re.match('here_isolines', elif re.match('_isolines$',
self._user_service_config.service_type) is not None: self._user_service_config.service_type) is not None:
return self.__check_isolines_quota() return self.__check_isolines_quota()
elif re.match('mapzen_isolines', elif re.match('^routing_',
self._user_service_config.service_type) is not None:
return self.__check_isolines_quota()
elif re.match('mapbox_isolines',
self._user_service_config.service_type) is not None:
return self.__check_isolines_quota()
elif re.match('tomtom_isolines',
self._user_service_config.service_type) is not None:
return self.__check_isolines_quota()
elif re.match('routing_mapzen',
self._user_service_config.service_type) is not None: self._user_service_config.service_type) is not None:
return self.__check_routing_quota() return self.__check_routing_quota()
elif re.match('routing_mapbox', elif re.match('^obs_',
self._user_service_config.service_type) is not None:
return self.__check_routing_quota()
elif re.match('routing_tomtom',
self._user_service_config.service_type) is not None:
return self.__check_routing_quota()
elif re.match('obs_*',
self._user_service_config.service_type) is not None: self._user_service_config.service_type) is not None:
return self.__check_data_observatory_quota() return self.__check_data_observatory_quota()
else: else: