Mercurial > hg > bnpparibas
comparison bnpparibas.py @ 13:37ce0dc68cad
Consider configuration parhs relartive to the configuration file location
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Mon, 11 Jan 2016 21:39:40 +0100 |
parents | 4747393db602 |
children | 0a3509a12762 |
comparison
equal
deleted
inserted
replaced
12:4747393db602 | 13:37ce0dc68cad |
---|---|
317 | 317 |
318 def main(): | 318 def main(): |
319 conffile = sys.argv[1] | 319 conffile = sys.argv[1] |
320 conf = loadconf(conffile) | 320 conf = loadconf(conffile) |
321 | 321 |
322 datadir = os.path.dirname(conffile) | |
323 for key in 'DATABASE', 'GNUPGHOME': | |
324 # if path is not absolute, it is interpreted as relative | |
325 # to the location of the configuration file | |
326 if not os.path.isabs(conf[key]): | |
327 conf[key] = os.path.join(datadir, conf[key]) | |
328 | |
322 db = sqlite3.connect(conf['DATABASE']) | 329 db = sqlite3.connect(conf['DATABASE']) |
323 db.execute('''CREATE TABLE IF NOT EXISTS messages (id TEXT PRIMARY KEY)''') | 330 db.execute('''CREATE TABLE IF NOT EXISTS messages (id TEXT PRIMARY KEY)''') |
324 db.execute('''CREATE TABLE IF NOT EXISTS transactions (id INTEGER PRIMARY KEY)''') | 331 db.execute('''CREATE TABLE IF NOT EXISTS transactions (id INTEGER PRIMARY KEY)''') |
325 | 332 |
326 sendmail = Mailer(host=conf['SMTPHOST'], | 333 sendmail = Mailer(host=conf['SMTPHOST'], |