Browse Source

Module 'auditlog' - A log can be created with no current HTTP request (unit tests, ir.cron...)

pull/707/head
sebalix 9 years ago
committed by Frédéric Garbely
parent
commit
d392c2012b
  1. 2
      auditlog/models/http_request.py
  2. 2
      auditlog/models/http_session.py

2
auditlog/models/http_request.py

@ -46,6 +46,8 @@ class AuditlogHTTPRequest(models.Model):
first call. first call.
If no HTTP request is available, returns `False`. If no HTTP request is available, returns `False`.
""" """
if not request:
return False
http_session_model = self.env['auditlog.http.session'] http_session_model = self.env['auditlog.http.session']
httprequest = request.httprequest httprequest = request.httprequest
if httprequest: if httprequest:

2
auditlog/models/http_session.py

@ -42,6 +42,8 @@ class AuditlogtHTTPSession(models.Model):
first call. first call.
If no HTTP user session is available, returns `False`. If no HTTP user session is available, returns `False`.
""" """
if not request:
return False
httpsession = request.httpsession httpsession = request.httpsession
if httpsession: if httpsession:
existing_session = self.search( existing_session = self.search(

Loading…
Cancel
Save