diff options
author | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2007-10-03 20:15:09 +0000 |
---|---|---|
committer | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2007-10-03 20:15:09 +0000 |
commit | aabae3e029f9b16fee7d65f87b9b736c0c1c0943 (patch) | |
tree | 438950103207124d8e1435c94a18eb14a33cfa3a /tko | |
parent | 3399e1655f3f85f6f26075b96e3cb4537ff022a0 (diff) |
Use full paths to access .config files for tko/db.py
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@742 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko')
-rw-r--r-- | tko/db.py | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -3,9 +3,11 @@ import MySQLdb, re, os, sys class db: def __init__(self, debug = False): self.debug = debug - + + path = os.path.dirname(os.path.abspath(sys.argv[0])) try: - db_prefs = open('.database', 'r') + file = os.path.join(path, '.database') + db_prefs = open(path, 'r') host = db_prefs.readline().rstrip() database = db_prefs.readline().rstrip() except: @@ -13,12 +15,14 @@ class db: database = 'tko' try: - login = open('.priv_login', 'r') + file = os.path.join(path, '.priv_login') + login = open(file, 'r') user = login.readline().rstrip() password = login.readline().rstrip() except: try: - login = open('.unpriv_login', 'r') + file = os.path.join(path, '.unpriv_login') + login = open(path, 'r') user = login.readline().rstrip() password = login.readline().rstrip() except: |