From 4e272542ea1681277e087f59a56b5cf62eafc64b Mon Sep 17 00:00:00 2001 From: cod-odoo Date: Fri, 12 Sep 2014 15:32:16 +0530 Subject: [PATCH] [IMP] database manager: options on dump format --- addons/web/controllers/main.py | 11 +++++++---- addons/web/static/src/xml/base.xml | 9 +++++++++ openerp/service/db.py | 15 ++++++++------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 0f4b3d36a1c..1bdaa3ed5f7 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -748,14 +748,17 @@ class Database(http.Controller): return {'error': _('Could not drop database !'), 'title': _('Drop Database')} @http.route('/web/database/backup', type='http', auth="none") - def backup(self, backup_db, backup_pwd, token): + def backup(self, backup_db, backup_pwd, token, **kwargs): try: + format = kwargs.get('format') + ext = "zip" if format == 'zip' else "dump" db_dump = base64.b64decode( - request.session.proxy("db").dump(backup_pwd, backup_db)) - filename = "%(db)s_%(timestamp)s.dump" % { + request.session.proxy("db").dump(backup_pwd, backup_db, format)) + filename = "%(db)s_%(timestamp)s.%(ext)s" % { 'db': backup_db, 'timestamp': datetime.datetime.utcnow().strftime( - "%Y-%m-%d_%H-%M-%SZ") + "%Y-%m-%d_%H-%M-%SZ"), + 'ext': ext } return request.make_response(db_dump, [('Content-Type', 'application/octet-stream; charset=binary'), diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index e48989890d4..cf785a5b2cf 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -228,6 +228,15 @@ + + + + + + + + +