def __init__(self): self.home_path = os.environ['HOME'] self.backup = self.home_path + "/.munger/hosts_backup.bak" # Initialize the database object for use by file manager self.dbstuff = datamunger.dataManager() # check for the backup, and create if it doesn't exist. Bad comments. backup_data = self.dbstuff.get_backup_file() if not backup_data: try: shutil.copy('/etc/hosts', self.home_path + "/.munger/hosts_backup.bak") self.dbstuff.record_backup_data(self.home_path + '/.munger/hosts_backup.bak') except IOError: print "Oops, trouble backing up your hosts file. Check write permissions in the home directory and try running this again." sys.exit(1) else: pass
def setUp(self): self.dbstuff = datamunger.dataManager(test=True) self.home_path = os.environ['HOME'] + '/.munger/test.db'