changeset 1590:ab54af2a9ab2

core (memory): fixed a case where getProfileName was returning an empty string instead of raising an errror
author Goffi <goffi@goffi.org>
date Sat, 14 Nov 2015 19:18:10 +0100
parents add1a6c8c594
children 0df9c6247474
files src/memory/params.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/memory/params.py	Sat Nov 14 19:18:10 2015 +0100
+++ b/src/memory/params.py	Sat Nov 14 19:18:10 2015 +0100
@@ -194,7 +194,8 @@
                             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 @@
                     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