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