Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Redner Odoo Module
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
Redner Odoo Module
Commits
edbd9c77
Commit
edbd9c77
authored
3 years ago
by
damien.habets
Browse files
Options
Downloads
Patches
Plain Diff
Improve logging
Request contents only logged at debug level.
parent
2fdfb808
No related branches found
No related tags found
2 merge requests
!19
forward port of 11.0 features
,
!14
Topic/13.0/task 418
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NEWS.rst
+2
-0
2 additions, 0 deletions
NEWS.rst
__manifest__.py
+1
-1
1 addition, 1 deletion
__manifest__.py
models/redner.py
+11
-5
11 additions, 5 deletions
models/redner.py
with
14 additions
and
6 deletions
NEWS.rst
+
2
−
0
View file @
edbd9c77
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
Move constant converter to converter module.
Move constant converter to converter module.
Fix a docstring (not an override).
Fix a docstring (not an override).
Credit OCA for report code.
Improve logging - request contents only logged at debug level.
13.0.2.0.1
13.0.2.0.1
==========
==========
...
...
This diff is collapsed.
Click to expand it.
__manifest__.py
+
1
−
1
View file @
edbd9c77
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
"
name
"
:
"
Redner
"
,
"
name
"
:
"
Redner
"
,
"
summary
"
:
"""
"
summary
"
:
"""
Allows to generate transactional emails and documents in PDF or HTML format
"""
,
Allows to generate transactional emails and documents in PDF or HTML format
"""
,
"
version
"
:
"
13.0.3.0.
1
"
,
"
version
"
:
"
13.0.3.0.
2
"
,
"
category
"
:
"
Technical
"
,
"
category
"
:
"
Technical
"
,
"
author
"
:
"
XCG Consulting
"
,
"
author
"
:
"
XCG Consulting
"
,
"
website
"
:
"
http://odoo.consulting/
"
,
"
website
"
:
"
http://odoo.consulting/
"
,
...
...
This diff is collapsed.
Click to expand it.
models/redner.py
+
11
−
5
View file @
edbd9c77
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
return
self
.
call_impl
(
path
,
http_verb
=
http_verb
,
**
params
)
return
self
.
call_impl
(
path
,
http_verb
=
http_verb
,
**
params
)
except
Exception
as
error
:
except
Exception
as
error
:
if
retry_counter
==
MAX_REDNERD_TRIES
-
1
:
if
retry_counter
==
MAX_REDNERD_TRIES
-
1
:
logger
.
error
(
"
Redner error: %s
"
,
str
(
error
))
raise
error
raise
error
def
call_impl
(
self
,
path
,
http_verb
=
"
post
"
,
**
params
):
def
call_impl
(
self
,
path
,
http_verb
=
"
post
"
,
**
params
):
...
@@ -51,6 +52,8 @@
...
@@ -51,6 +52,8 @@
path(str): URL path to query, eg.
'
/template/
'
path(str): URL path to query, eg.
'
/template/
'
http_verb(str): http verb to use, default:
'
post
'
http_verb(str): http verb to use, default:
'
post
'
params(dict): json payload
params(dict): json payload
This method can raise anything; callers are expected to catch.
"""
"""
if
not
self
.
server_url
:
if
not
self
.
server_url
:
...
@@ -59,6 +62,6 @@
...
@@ -59,6 +62,6 @@
"
Please add it in odoo.conf or in ir.config_parameter
"
"
Please add it in odoo.conf or in ir.config_parameter
"
)
)
endpoint
=
urljoin
(
self
.
server_url
,
path
)
url
=
urljoin
(
self
.
server_url
,
path
)
_http_verb
=
http_verb
.
upper
()
_http_verb
=
http_verb
.
upper
()
...
@@ -63,6 +66,7 @@
...
@@ -63,6 +66,7 @@
_http_verb
=
http_verb
.
upper
()
_http_verb
=
http_verb
.
upper
()
logger
.
info
(
"
%s to %s: %s
"
%
(
_http_verb
,
endpoint
,
params
))
logger
.
info
(
"
Redner: Calling %s...
"
,
_http_verb
)
logger
.
debug
(
"
Redner: Sending to %s > %s
"
,
url
,
params
)
start
=
time
.
time
()
start
=
time
.
time
()
r
=
getattr
(
self
.
session
,
http_verb
,
"
post
"
)(
r
=
getattr
(
self
.
session
,
http_verb
,
"
post
"
)(
...
@@ -66,8 +70,8 @@
...
@@ -66,8 +70,8 @@
start
=
time
.
time
()
start
=
time
.
time
()
r
=
getattr
(
self
.
session
,
http_verb
,
"
post
"
)(
r
=
getattr
(
self
.
session
,
http_verb
,
"
post
"
)(
endpoint
,
json
=
params
,
headers
=
{
"
Rednerd-API-Key
"
:
self
.
api_key
}
url
,
json
=
params
,
headers
=
{
"
Rednerd-API-Key
"
:
self
.
api_key
}
)
)
complete_time
=
time
.
time
()
-
start
complete_time
=
time
.
time
()
-
start
logger
.
info
(
logger
.
info
(
...
@@ -70,7 +74,8 @@
...
@@ -70,7 +74,8 @@
)
)
complete_time
=
time
.
time
()
-
start
complete_time
=
time
.
time
()
-
start
logger
.
info
(
logger
.
info
(
"
Received %s in %.2fms: %s
"
"
Redner: Received %s in %.2fms.
"
,
%
(
r
.
status_code
,
complete_time
*
1000
,
r
.
text
)
r
.
status_code
,
complete_time
*
1000
,
)
)
...
@@ -76,4 +81,5 @@
...
@@ -76,4 +81,5 @@
)
)
logger
.
debug
(
"
Redner: Received %s
"
,
r
.
text
)
try
:
try
:
response
=
r
.
json
()
response
=
r
.
json
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment