[MERGE] Forward-port of latest saas-3 bugfixes, up to rev. a096ae0080

This commit is contained in:
Denis Ledoux 2014-05-22 09:35:26 +02:00
commit c0e9a15960
3 changed files with 5 additions and 6 deletions

View File

@ -126,6 +126,7 @@ class ir_http(orm.AbstractModel):
return response return response
def _handle_exception(self, exception=None, code=500): def _handle_exception(self, exception=None, code=500):
res = super(ir_http, self)._handle_exception(exception)
if isinstance(exception, werkzeug.exceptions.HTTPException) and hasattr(exception, 'response') and exception.response: if isinstance(exception, werkzeug.exceptions.HTTPException) and hasattr(exception, 'response') and exception.response:
return exception.response return exception.response
@ -168,7 +169,7 @@ class ir_http(orm.AbstractModel):
html = request.website._render('website.http_error', values) html = request.website._render('website.http_error', values)
return werkzeug.wrappers.Response(html, status=code, content_type='text/html;charset=utf-8') return werkzeug.wrappers.Response(html, status=code, content_type='text/html;charset=utf-8')
return super(ir_http, self)._handle_exception(exception) return res
class ModelConverter(ir.ir_http.ModelConverter): class ModelConverter(ir.ir_http.ModelConverter):
def __init__(self, url_map, model=False, domain='[]'): def __init__(self, url_map, model=False, domain='[]'):

View File

@ -267,7 +267,7 @@ class WebRequest(object):
"""Called within an except block to allow converting exceptions """Called within an except block to allow converting exceptions
to abitrary responses. Anything returned (except None) will to abitrary responses. Anything returned (except None) will
be used as response.""" be used as response."""
raise self._failed = exception # prevent tx commit
def _call_function(self, *args, **kwargs): def _call_function(self, *args, **kwargs):
request = self request = self
@ -449,8 +449,8 @@ class JsonRequest(WebRequest):
"""Called within an except block to allow converting exceptions """Called within an except block to allow converting exceptions
to abitrary responses. Anything returned (except None) will to abitrary responses. Anything returned (except None) will
be used as response.""" be used as response."""
super(JsonRequest, self)._handle_exception(exception)
_logger.exception("Exception during JSON request handling.") _logger.exception("Exception during JSON request handling.")
self._failed = exception # prevent tx commit
error = { error = {
'code': 200, 'code': 200,
'message': "OpenERP Server Error", 'message': "OpenERP Server Error",

View File

@ -107,7 +107,7 @@ class NumberedCanvas(canvas.Canvas):
self.setFont("Helvetica", 8) self.setFont("Helvetica", 8)
self.drawRightString((self._pagesize[0]-30), (self._pagesize[1]-40), self.drawRightString((self._pagesize[0]-30), (self._pagesize[1]-40),
" %(this)i / %(total)i" % { " %(this)i / %(total)i" % {
'this': self._pageNumber+1, 'this': self._pageNumber,
'total': page_count, 'total': page_count,
} }
) )
@ -1007,8 +1007,6 @@ class _rml_template(object):
if story_cnt > 0: if story_cnt > 0:
fis.append(platypus.PageBreak()) fis.append(platypus.PageBreak())
fis += r.render(node_story) fis += r.render(node_story)
# Reset Page Number with new story tag
fis.append(PageReset())
story_cnt += 1 story_cnt += 1
try: try:
if self.localcontext and self.localcontext.get('internal_header',False): if self.localcontext and self.localcontext.get('internal_header',False):