comparison src/memory/params.py @ 1519:fbe86b5d156f

core (memory, params): minor docstrings updates
author Goffi <goffi@goffi.org>
date Fri, 25 Sep 2015 19:19:12 +0200
parents 7a9cef71ae43
children a5e0393a06cd
comparison
equal deleted inserted replaced
1518:8c071bc359c9 1519:fbe86b5d156f
188 188
189 def getProfileName(self, profile_key, return_profile_keys=False): 189 def getProfileName(self, profile_key, return_profile_keys=False):
190 """return profile according to profile_key 190 """return profile according to profile_key
191 191
192 @param profile_key: profile name or key which can be 192 @param profile_key: profile name or key which can be
193 @ALL@ for all profiles 193 C.PROF_KEY_ALL for all profiles
194 @DEFAULT@ for default profile 194 C.PROF_KEY_DEFAULT for default profile
195 @param return_profile_keys: if True, return unmanaged profile keys (like "@ALL@"). This keys must be managed by the caller 195 @param return_profile_keys: if True, return unmanaged profile keys (like C.PROF_KEY_ALL). This keys must be managed by the caller
196 @return: requested profile name 196 @return: requested profile name
197 @raise exceptions.ProfileUnknownError if profile doesn't exists 197 @raise exceptions.ProfileUnknownError if profile doesn't exists
198 """ 198 """
199 if profile_key == '@DEFAULT@': 199 if profile_key == '@DEFAULT@':
200 default = self.host.memory.memory_data.get('Profile_default') 200 default = self.host.memory.memory_data.get('Profile_default')
206 log.info(_('No profile exist yet')) 206 log.info(_('No profile exist yet'))
207 return "" 207 return ""
208 return default # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists 208 return default # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
209 elif profile_key == C.PROF_KEY_NONE: 209 elif profile_key == C.PROF_KEY_NONE:
210 raise exceptions.ProfileNotSetError 210 raise exceptions.ProfileNotSetError
211 elif return_profile_keys and profile_key in ["@ALL@"]: 211 elif return_profile_keys and profile_key in [C.PROF_KEY_ALL]:
212 return profile_key # this value must be managed by the caller 212 return profile_key # this value must be managed by the caller
213 if not self.storage.hasProfile(profile_key): 213 if not self.storage.hasProfile(profile_key):
214 log.error(_(u'Trying to access an unknown profile (%s)') % profile_key) 214 log.error(_(u'Trying to access an unknown profile (%s)') % profile_key)
215 raise exceptions.ProfileUnknownError 215 raise exceptions.ProfileUnknownError
216 return profile_key 216 return profile_key