Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
aea28645
Commit
aea28645
authored
Dec 04, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_deferred_style: send a notification if there has error when generate report
parent
a57cd756
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
24 deletions
+39
-24
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.py
...l_skins/erp5_deferred_style_core/Base_renderSimpleView.py
+39
-24
No files found.
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.py
View file @
aea28645
...
...
@@ -12,28 +12,43 @@ 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
):
report_data
=
getattr
(
context
,
deferred_style_dialog_method
)(
**
params
)
try
:
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
)
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment