changeset 2251:83bcd9ec4782

core: fixed profile key detection in getClients + raise DataError on empty profile
author Goffi <goffi@goffi.org>
date Sun, 21 May 2017 19:59:42 +0200
parents 6c1070ae1b7d
children cffa50c9f26b
files src/core/sat_main.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/sat_main.py	Sun May 21 19:57:46 2017 +0200
+++ b/src/core/sat_main.py	Sun May 21 19:59:42 2017 +0200
@@ -455,13 +455,15 @@
         @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]]