From 56aad3c6e61d025ecd2a63ce6e08e506b991d18c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 18 Aug 2011 17:40:54 +0530 Subject: [PATCH] changed db password logic --- cgi-bin/webnotes/auth.py | 2 +- cgi-bin/webnotes/db.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cgi-bin/webnotes/auth.py b/cgi-bin/webnotes/auth.py index d15309020b..d2b35075f9 100644 --- a/cgi-bin/webnotes/auth.py +++ b/cgi-bin/webnotes/auth.py @@ -104,7 +104,7 @@ class HTTPRequest: else: db_name = getattr(webnotes.defs,'default_db_name','') - webnotes.conn = webnotes.db.Database(user = db_name,password = getattr(webnotes.defs,'db_password','')) + webnotes.conn = webnotes.db.Database(user = db_name,password = getattr(webnotes.defs,'db_password', None)) webnotes.ac_name = ac_name # ================================================================================= diff --git a/cgi-bin/webnotes/db.py b/cgi-bin/webnotes/db.py index 8d175e317e..45837a2051 100644 --- a/cgi-bin/webnotes/db.py +++ b/cgi-bin/webnotes/db.py @@ -26,7 +26,7 @@ class Database: self.transaction_writes = 0 self.testing_tables = [] - self.password = self.get_db_password(ac_name, password) + self.password = self.get_db_password(user, password) self.connect() if self.user != 'root': @@ -57,7 +57,9 @@ class Database: return '' def get_db_login(self, ac_name): - return getattr(defs,'db_name_map').get(ac_name, getattr(defs,'default_db_name')) + if hasattr(defs, 'db_name_map'): + return getattr(defs,'db_name_map').get(ac_name, getattr(defs,'default_db_name')) + else: return ac_name def connect(self): """