diff options
| author | Christophe Simonis <chs@tinyerp.com> | 2009-12-01 14:32:14 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@tinyerp.com> | 2009-12-01 14:32:14 +0100 |
| commit | e345e91365f2ab3c9130a3903715b1e1db5a477d (patch) | |
| tree | 33d5fd0b8a7f59e6d82c039638e26a29c74a87f0 /bin/sql_db.py | |
| parent | 229c73d741a2d902ae64335ec5bdeeb58d8fa54e (diff) | |
[FIX] db_exist method works as expected
bzr revid: chs@tinyerp.com-20091201133214-8c6i1ohk5t5u79dz
Diffstat (limited to 'bin/sql_db.py')
| -rw-r--r-- | bin/sql_db.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/sql_db.py b/bin/sql_db.py index 6d2d8b779ef..59d7bcaac1f 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -310,6 +310,15 @@ class Connection(object): def serialized_cursor(self): return self.cursor(True) + def __nonzero__(self): + """Check if connection is possible""" + try: + cr = self.cursor() + cr.close() + return True + except: + return False + _dsn = '' for p in ('host', 'port', 'user', 'password'): |
