From d6087e208fa372f12536c30342deb898d3883c6f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 14 Dec 2012 16:29:57 +0100 Subject: [PATCH] [FIX] flow control annoyances bzr revid: xmo@openerp.com-20121214152957-izvuo2u0uvpuv2ho --- addons/web/controllers/main.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index d4fe2d79acc..e47a716b2bc 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1276,11 +1276,11 @@ class Binary(openerpweb.Controller): @openerpweb.httprequest def upload(self, req, callback, ufile): # TODO: might be useful to have a configuration flag for max-length file uploads + out = """""" try: - out = """""" data = ufile.read() args = [len(data), ufile.filename, ufile.content_type, base64.b64encode(data)] @@ -1291,11 +1291,11 @@ class Binary(openerpweb.Controller): @openerpweb.httprequest def upload_attachment(self, req, callback, model, id, ufile): Model = req.session.model('ir.attachment') + out = """""" try: - out = """""" attachment_id = Model.create({ 'name': ufile.filename, 'datas': base64.encodestring(ufile.read()), @@ -1307,7 +1307,7 @@ class Binary(openerpweb.Controller): 'filename': ufile.filename, 'id': attachment_id } - except Exception,e: + except xmlrpclib.Fault, e: args = {'error':e.faultCode } return out % (simplejson.dumps(callback), simplejson.dumps(args))