core, bridge: added a profileSetDefault method

This commit is contained in:
Goffi 2015-11-14 19:18:10 +01:00
commit 182f192703
2 changed files with 40 additions and 2 deletions

View file

@ -433,6 +433,16 @@ class Memory(object):
"""
return self.params.getProfileName(profile_key, return_profile_keys)
def profileSetDefault(self, profile):
"""Set default profile
@param profile: %(doc_profile)s
"""
# we want to be sure that the profile exists
profile = self.getProfileName(profile)
self.memory_data['Profile_default'] = profile
def asyncCreateProfile(self, name, password=''):
"""Create a new profile
@param name: profile name

View file

@ -200,7 +200,7 @@ class Params(object):
if profile_key == '@DEFAULT@':
default = self.host.memory.memory_data.get('Profile_default')
if not default:
log.info(_('No default profile, returning first one')) # TODO: manage real default profile
log.info(_('No default profile, returning first one'))
try:
default = self.host.memory.memory_data['Profile_default'] = self.storage.getProfilesList()[0]
except IndexError: