core: fixed profile key detection in getClients + raise DataError on empty profile

This commit is contained in:
Goffi 2017-05-21 19:59:42 +02:00
commit a4b122094c

View file

@ -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]]