From 1397a37855163fc727e6d907851613e08105179d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Aug 2011 22:11:02 +0530 Subject: [PATCH] Changed backup script to get password from defs --- cgi-bin/webnotes/utils/backups.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cgi-bin/webnotes/utils/backups.py b/cgi-bin/webnotes/utils/backups.py index 8865481ade..26e1f98771 100644 --- a/cgi-bin/webnotes/utils/backups.py +++ b/cgi-bin/webnotes/utils/backups.py @@ -123,7 +123,7 @@ def get_backup(): """ #if verbose: print webnotes.conn.cur_db_name + " " + webnotes.defs.db_password odb = BackupGenerator(webnotes.conn.cur_db_name, webnotes.conn.cur_db_name,\ - webnotes.defs.db_password) + get_db_password(webnotes.conn.cur_db_name)) recipient_list = odb.get_backup() delete_temp_backups() webnotes.msgprint("""A download link to your backup will be emailed \ @@ -131,6 +131,19 @@ def get_backup(): %s""" % (', '.join(recipient_list))) +def get_db_password(db_name): + """ + Get db password from defs + """ + from webnotes import defs + if hasattr(defs, 'get_db_password'): + return defs.get_db_password(db_name) + + if hasattr(defs, 'db_password'): + return defs.db_password + + + def delete_temp_backups(): """ Cleans up the backup_link_path directory by deleting files older than 24 hours