comparison src/memory/memory.py @ 625:5646ecd3e35e

core: fixed crash on first run, when no profile exist yet fix bug 24
author Goffi <goffi@goffi.org>
date Thu, 20 Jun 2013 17:22:40 +0200
parents 64db6758d223
children ca2cae6b2c6d
comparison
equal deleted inserted replaced
624:70988f08d0ad 625:5646ecd3e35e
187 @return: requested profile name or None if it doesn't exist""" 187 @return: requested profile name or None if it doesn't exist"""
188 if profile_key == '@DEFAULT@': 188 if profile_key == '@DEFAULT@':
189 default = self.host.memory.memory_data.get('Profile_default') 189 default = self.host.memory.memory_data.get('Profile_default')
190 if not default: 190 if not default:
191 info(_('No default profile, returning first one')) # TODO: manage real default profile 191 info(_('No default profile, returning first one')) # TODO: manage real default profile
192 default = self.host.memory.memory_data['Profile_default'] = self.storage.getProfilesList()[0] 192 try:
193 default = self.host.memory.memory_data['Profile_default'] = self.storage.getProfilesList()[0]
194 except IndexError:
195 info(_('No profile exist yet'))
196 return ""
193 return default # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists 197 return default # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
194 if not self.storage.hasProfile(profile_key): 198 if not self.storage.hasProfile(profile_key):
195 info(_('Trying to access an unknown profile')) 199 info(_('Trying to access an unknown profile'))
196 return "" 200 return ""
197 return profile_key 201 return profile_key