comparison profilemanager/manager.py @ 59:ee2777913a9e

check the correct way to see if the option is there
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 May 2010 12:02:33 -0700
parents ce6a101fb239
children 24782e4c70ca
comparison
equal deleted inserted replaced
58:ce6a101fb239 59:ee2777913a9e
7 import string 7 import string
8 import time 8 import time
9 import ConfigParser 9 import ConfigParser
10 from random import Random 10 from random import Random
11 from utils import format_tabular 11 from utils import format_tabular
12 #from ConfigParser import NoOptionError
12 from ConfigParser import SafeConfigParser as ConfigParser 13 from ConfigParser import SafeConfigParser as ConfigParser
13 14
14 # Changes to profiles.ini: 15 # Changes to profiles.ini:
15 # - add a ``backups`` field for each profile: 16 # - add a ``backups`` field for each profile:
16 # Backups = /path/to/backup:1273104310 /path/to/other/backup:1273104355 17 # Backups = /path/to/backup:1273104310 /path/to/other/backup:1273104355
311 parser = self.parser() 312 parser = self.parser()
312 retval = {} 313 retval = {}
313 for section in parser.sections(): 314 for section in parser.sections():
314 if section == 'General': 315 if section == 'General':
315 continue 316 continue
316 try: 317 if not parser.has_option(section, 'Name'):
317 name = parser.get(section, 'name')
318 except ConfigParser.NoOptionError:
319 continue 318 continue
319 name = parser.get_option(section, 'Name')
320 retval[name] = self.profile_dict(name) 320 retval[name] = self.profile_dict(name)
321 return retval 321 return retval
322 322
323 def hash(self): 323 def hash(self):
324 """ 324 """