core (memory): fixed a case where getProfileName was returning an empty string instead of raising an errror

This commit is contained in:
Goffi 2015-11-14 19:18:10 +01:00
commit 736dbfa1b4

View file

@ -194,7 +194,8 @@ class Params(object):
C.PROF_KEY_DEFAULT for default profile
@param return_profile_keys: if True, return unmanaged profile keys (like C.PROF_KEY_ALL). This keys must be managed by the caller
@return: requested profile name
@raise exceptions.ProfileUnknownError if profile doesn't exists
@raise exceptions.ProfileUnknownError: profile doesn't exists
@raise exceptions.ProfileNotSetError: if C.PROF_KEY_NONE is used
"""
if profile_key == '@DEFAULT@':
default = self.host.memory.memory_data.get('Profile_default')
@ -204,7 +205,7 @@ class Params(object):
default = self.host.memory.memory_data['Profile_default'] = self.storage.getProfilesList()[0]
except IndexError:
log.info(_('No profile exist yet'))
return ""
raise exceptions.ProfileUnknownError
return default # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
elif profile_key == C.PROF_KEY_NONE:
raise exceptions.ProfileNotSetError