def main(argv): # from minds.safe_config import cfg from minds.config import cfg print cfg while True: print '\nEnter key to query. Enter key=value to set. "show" to show all values. "save" to save config.' line = raw_input('Config key: ') if not line: break if line == 'show': print cfg continue elif line =='save': cfg.save() continue # set key=value? if '=' in line: key, value = line.split('=',1) cfg.set(key, value) else: key = line # query try: value = cfg.get(key,'n/a') print '%s=%s' % (key,value) except Exception, e: print e
def save(self): cfg.set('upgrade_notification.fetch_date', str(self.fetch_date)) cfg.set('upgrade_notification.fetch_frequency', str(self.fetch_frequency)) cfg.set('upgrade_notification.last_entry_date', self.last_entry_date or '') cfg.save()