diff src/core/sat_main.py @ 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 61128d260eef
children 24f5a4d5f195
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]]