Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
2250:6c1070ae1b7d | 2251:83bcd9ec4782 |
---|---|
453 """Convenient method to get list of clients from profile key (manage list through profile_key like C.PROF_KEY_ALL) | 453 """Convenient method to get list of clients from profile key (manage list through profile_key like C.PROF_KEY_ALL) |
454 | 454 |
455 @param profile_key: %(doc_profile_key)s | 455 @param profile_key: %(doc_profile_key)s |
456 @return: list of clients | 456 @return: list of clients |
457 """ | 457 """ |
458 if not profile_key: | |
459 raise exceptions.DataError(_(u'profile_key must not be empty')) | |
458 try: | 460 try: |
459 profile = self.memory.getProfileName(profile_key, True) | 461 profile = self.memory.getProfileName(profile_key, True) |
460 except exceptions.ProfileUnknownError: | 462 except exceptions.ProfileUnknownError: |
461 return [] | 463 return [] |
462 if profile == C.PROF_KEY_ALL: | 464 if profile == C.PROF_KEY_ALL: |
463 return self.profiles.values() | 465 return self.profiles.values() |
464 elif profile.count('@') > 1: | 466 elif profile[0] == '@': # only profile keys can start with "@" |
465 raise exceptions.ProfileKeyUnknown | 467 raise exceptions.ProfileKeyUnknown |
466 return [self.profiles[profile]] | 468 return [self.profiles[profile]] |
467 | 469 |
468 def _getConfig(self, section, name): | 470 def _getConfig(self, section, name): |
469 """Get the main configuration option | 471 """Get the main configuration option |