Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion auditlog/models/http_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from psycopg2.extensions import AsIs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One line space between third modules and Odoo imports?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, this is not linted and it's not even in the guidelines. https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#imports only explicitely mentions the order of the imports, even if it uses newlines to clarify the grouping in the example. Seems like a cornercase to me, no?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is, that's why I am not blocking the PR ;) I'm used to do this to clarify the Python dependencies (like the example you linked), and it must be difficult for a quality checker to guess that I think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the guidelines recommend us run isort
This lint detect this case and auto-fix.
But it is optional.
If you don't want is goos to us

from openerp import models, fields, api
from openerp.http import request

Expand Down Expand Up @@ -47,7 +48,14 @@ def current_http_request(self):
httprequest = request.httprequest
if httprequest:
if hasattr(httprequest, 'auditlog_http_request_id'):
return httprequest.auditlog_http_request_id
# Verify existence. Could have been rolled back after a
# concurrency error
self.env.cr.execute(
"SELECT id FROM %s WHERE id = %s", (
AsIs(self._table),
httprequest.auditlog_http_request_id))
if self.env.cr.fetchone():
return httprequest.auditlog_http_request_id
vals = {
'name': httprequest.path,
'root_url': httprequest.url_root,
Expand Down