From a4b122094c672c7d216138dea379d9bb74520024 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 21 May 2017 19:59:42 +0200 Subject: [PATCH] core: fixed profile key detection in getClients + raise DataError on empty profile --- src/core/sat_main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/sat_main.py b/src/core/sat_main.py index 9e6e4201..2710a0c1 100644 --- a/src/core/sat_main.py +++ b/src/core/sat_main.py @@ -455,13 +455,15 @@ class SAT(service.Service): @param profile_key: %(doc_profile_key)s @return: list of clients """ + if not profile_key: + raise exceptions.DataError(_(u'profile_key must not be empty')) try: profile = self.memory.getProfileName(profile_key, True) except exceptions.ProfileUnknownError: return [] if profile == C.PROF_KEY_ALL: return self.profiles.values() - elif profile.count('@') > 1: + elif profile[0] == '@': # only profile keys can start with "@" raise exceptions.ProfileKeyUnknown return [self.profiles[profile]]