Commit 6c927939 authored by Jérome Perrin's avatar Jérome Perrin

Revert "erp5_deferred_style: send a notification if there has error when generate report"

This reverts commit 750e2bfc.

This looks wrong to me, we don't send errors to users like this. And if we
really want to do, we should ignore error like this but use CMFActivity
error call back.

For now, let's revert.
parent 63dd57c0
......@@ -12,43 +12,28 @@ if skin_name and skin_name != 'None': # make_query serializes None as 'None'
portal.portal_skins.changeSkin(skin_name)
with portal.Localizer.translationContext(localizer_language):
try:
report_data = getattr(context, deferred_style_dialog_method)(**params)
report_data = getattr(context, deferred_style_dialog_method)(**params)
attachment_name_list = [x[len(' filename='):] for x in (request.RESPONSE.getHeader(
'content-disposition') or '').split(';')
if x.startswith(' filename=')]
if attachment_name_list:
attachment_name, = attachment_name_list
else:
assert 'inline' in (request.RESPONSE.getHeader('content-disposition') or '')
attachment_name = 'index.html'
if attachment_name.startswith('"'):
attachment_name = attachment_name[1:]
if attachment_name.endswith('"'):
attachment_name = attachment_name[:-1]
attachment_list = (
{'mime_type': (request.RESPONSE.getHeader('content-type') or 'application/octet-stream;').split(';')[0],
'content': '%s' % report_data,
'name': attachment_name},)
portal.ERP5Site_notifyReportComplete(
user_name=user_name,
subject=str(translateString(attachment_name.rsplit('.', 1)[0])),
message='',
attachment_list=attachment_list,
format=report_format)
except Exception, Error:
if type(report_data) is dict and report_data.pop('status', 0) == -2:
message = report_data.pop('message')
subject = report_data.pop('subject')
else:
message = 'Unknown Error, Please Retry'
subject = 'ERP5: Deferred Report'
portal.ERP5Site_notifyReportComplete(
user_name=user_name,
subject=subject,
attachment_list = [],
message=message,
format=report_format
)
context.log(Error)
attachment_name_list = [x[len(' filename='):] for x in (request.RESPONSE.getHeader(
'content-disposition') or '').split(';')
if x.startswith(' filename=')]
if attachment_name_list:
attachment_name, = attachment_name_list
else:
assert 'inline' in (request.RESPONSE.getHeader('content-disposition') or '')
attachment_name = 'index.html'
if attachment_name.startswith('"'):
attachment_name = attachment_name[1:]
if attachment_name.endswith('"'):
attachment_name = attachment_name[:-1]
attachment_list = (
{'mime_type': (request.RESPONSE.getHeader('content-type') or 'application/octet-stream;').split(';')[0],
'content': '%s' % report_data,
'name': attachment_name},)
portal.ERP5Site_notifyReportComplete(
user_name=user_name,
subject=str(translateString(attachment_name.rsplit('.', 1)[0])),
message='',
attachment_list=attachment_list,
format=report_format)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment