comparison pylons_app/lib/backup_manager.py @ 27:8f29ddc4c147

fixed the backup script path problems
author Marcin Kuzminski
date Mon, 01 Mar 2010 11:29:40 +0100
parents b3307ca60bfb
children fd0c6fa2df82
comparison
equal deleted inserted replaced
26:b3307ca60bfb 27:8f29ddc4c147
8 format = "%(asctime)s %(levelname)-5.5s %(message)s") 8 format = "%(asctime)s %(levelname)-5.5s %(message)s")
9 9
10 class BackupManager(object): 10 class BackupManager(object):
11 def __init__(self): 11 def __init__(self):
12 12
13 cur_dir = os.path.realpath(__file__)
13 dn = os.path.dirname 14 dn = os.path.dirname
14 self.backup_file_path = os.path.join(dn(dn(dn(__file__))), 'data') 15 self.backup_file_path = os.path.join(dn(dn(dn(cur_dir))), 'data')
15 cfg = config.config() 16 cfg = config.config()
16 try: 17 try:
17 cfg.read(os.path.join(dn(dn(dn(__file__))), 'hgwebdir.config')) 18 cfg.read(os.path.join(dn(dn(dn(cur_dir))), 'hgwebdir.config'))
18 except IOError: 19 except IOError:
19 logging.error('Could not read hgwebdir.config') 20 logging.error('Could not read hgwebdir.config')
20 sys.exit() 21 sys.exit()
21 self.set_repos_path(cfg.items('paths')) 22 self.set_repos_path(cfg.items('paths'))
22 logging.info('starting backup for %s', self.repos_path) 23 logging.info('starting backup for %s', self.repos_path)