[FIX]Minor changes.
bzr revid: vja@tinyerp.com-20120621090425-wa3lrw5tait9lt9s
This commit is contained in:
parent
87afddd907
commit
26dc7e2fa9
|
@ -437,18 +437,21 @@ class Database(openerpweb.Controller):
|
||||||
|
|
||||||
@openerpweb.httprequest
|
@openerpweb.httprequest
|
||||||
def backup(self, req, backup_db, backup_pwd, token):
|
def backup(self, req, backup_db, backup_pwd, token):
|
||||||
db_dump = base64.b64decode(
|
try:
|
||||||
req.session.proxy("db").dump(backup_pwd, backup_db))
|
db_dump = base64.b64decode(
|
||||||
filename = "%(db)s_%(timestamp)s.dump" % {
|
req.session.proxy("db").dump(backup_pwd, backup_db))
|
||||||
'db': backup_db,
|
filename = "%(db)s_%(timestamp)s.dump" % {
|
||||||
'timestamp': datetime.datetime.utcnow().strftime(
|
'db': backup_db,
|
||||||
"%Y-%m-%d_%H-%M-%SZ")
|
'timestamp': datetime.datetime.utcnow().strftime(
|
||||||
}
|
"%Y-%m-%d_%H-%M-%SZ")
|
||||||
return req.make_response(db_dump,
|
}
|
||||||
[('Content-Type', 'application/octet-stream; charset=binary'),
|
return req.make_response(db_dump,
|
||||||
('Content-Disposition', 'attachment; filename="' + filename + '"')],
|
[('Content-Type', 'application/octet-stream; charset=binary'),
|
||||||
{'fileToken': int(token)}
|
('Content-Disposition', 'attachment; filename="' + filename + '"')],
|
||||||
)
|
{'fileToken': int(token)}
|
||||||
|
)
|
||||||
|
except xmlrpclib.Fault, e:
|
||||||
|
return simplejson.dumps([[],[{'error': e.faultCode, 'title': 'backup Database'}]])
|
||||||
|
|
||||||
@openerpweb.httprequest
|
@openerpweb.httprequest
|
||||||
def restore(self, req, db_file, restore_pwd, new_db):
|
def restore(self, req, db_file, restore_pwd, new_db):
|
||||||
|
|
|
@ -392,13 +392,13 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
|
||||||
success: function () {
|
success: function () {
|
||||||
self.do_notify(_t("Backed"), _t("Database backed up successfully"));
|
self.do_notify(_t("Backed"), _t("Database backed up successfully"));
|
||||||
},
|
},
|
||||||
error: function(){
|
error: function(error){
|
||||||
if (instance.webclient.crashmanager.on_rpc_error) {
|
if(error){
|
||||||
self.display_error({
|
self.display_error({
|
||||||
title: 'Backup Database',
|
title: 'Backup Database',
|
||||||
error: 'AccessDenied'
|
error: 'AccessDenied'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
self.unblockUI();
|
self.unblockUI();
|
||||||
|
|
|
@ -332,11 +332,14 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
|
||||||
.appendTo(document.body)
|
.appendTo(document.body)
|
||||||
.load(function () {
|
.load(function () {
|
||||||
try {
|
try {
|
||||||
if (options.error) {
|
if (options.error) {
|
||||||
options.error(JSON.parse(
|
if (!this.contentDocument.body.childNodes[1]) {
|
||||||
this.contentDocument.body.childNodes[1].textContent
|
options.error(this.contentDocument.body.childNodes);
|
||||||
));
|
}
|
||||||
}
|
else {
|
||||||
|
options.error(JSON.parse(this.contentDocument.body.childNodes[1].textContent));
|
||||||
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue