comparison profilemanager/manager.py @ 27:5988a15da3b4

things are being awful; checking in anyway
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 06 May 2010 16:47:12 -0700
parents d260de170cca
children 105ecbac0928
comparison
equal deleted inserted replaced
26:d260de170cca 27:5988a15da3b4
182 profile = self.profile_dict(profile) 182 profile = self.profile_dict(profile)
183 if profile.get('isrelative', None) == '1': 183 if profile.get('isrelative', None) == '1':
184 return os.path.join(self.profile_dir, profile['path']) 184 return os.path.join(self.profile_dir, profile['path'])
185 return profile['path'] 185 return profile['path']
186 186
187 def profile_dict(self, profile):
188 """
189 return option dictionary for a single profile
190 """
191 parser = self.parser()
192 section = self.section(profile, parser)
193 if section is None:
194 raise ProfileNotFound('Profile %s not found in %s' % (profile, self.profiles))
195 return dict(parser.items(section))
196
197 def section(self, profile, parser=None): 187 def section(self, profile, parser=None):
198 """ 188 """
199 returns the name of the section that a profile is in or None 189 returns the name of the section that a profile is in or None
200 if not found 190 if not found
201 """ 191 """
204 for section in parser.section(): 194 for section in parser.section():
205 if not parser.has_option(section, 'name'): 195 if not parser.has_option(section, 'name'):
206 continue # not a profile 196 continue # not a profile
207 if parser.get(section, 'name') == profile: 197 if parser.get(section, 'name') == profile:
208 return section 198 return section
199
200 def profile_dict(self, profile):
201 """
202 return option dictionary for a single profile
203 """
204 parser = self.parser()
205 section = self.section(profile, parser)
206 if section is None:
207 raise ProfileNotFound('Profile %s not found in %s' % (profile, self.profiles))
208 return dict(parser.items(section))
209 209
210 def profiles_dict(self): 210 def profiles_dict(self):
211 """ 211 """
212 return nested dict of all profiles 212 return nested dict of all profiles
213 """ 213 """