diff --git a/website_catch_500/models/ir_http.py b/website_catch_500/models/ir_http.py
index 965feadf..2490c028 100644
--- a/website_catch_500/models/ir_http.py
+++ b/website_catch_500/models/ir_http.py
@@ -9,8 +9,8 @@ class HttpInherit(models.AbstractModel):
@classmethod
def _get_error_html(cls, env, code, values):
- if code == 500:
- # if code == 500 or code == "page_500"
+ if code == 500 or code == "page_500":
+ # if code == 500 or code == "page_500"
website = request.website
if website and website.catch_500_errors:
website._catch_500_error(request.httprequest)
diff --git a/website_catch_500/models/website.py b/website_catch_500/models/website.py
index c67b748f..3ad8a1c1 100644
--- a/website_catch_500/models/website.py
+++ b/website_catch_500/models/website.py
@@ -4,24 +4,6 @@
from urllib.parse import urlparse, urlunparse
-def remove_domain_and_protocol(url):
- """
- Removes domain and protocol from the url.
- """
- parsed_url = urlparse(url)
- modified_url = urlunparse(
- (
- "",
- "",
- parsed_url.path,
- parsed_url.params,
- parsed_url.query,
- parsed_url.fragment,
- )
- )
- return modified_url
-
-
class Website(models.Model):
_inherit = "website"
@@ -33,14 +15,22 @@ class Website(models.Model):
)
def _catch_500_error(self, request):
- url = remove_domain_and_protocol(request.url)
+ url = request.url
+ http_param = request.query_string
request_method = request.method
website_id = self.id
error = (
self.env["website.500.errors"]
.sudo()
- .search([("name", "=", url), ("website_id", "=", website_id)])
+ .search(
+ [
+ ("name", "=", url),
+ ("website_id", "=", website_id),
+ ("http_param", "=", http_param or ""),
+ ]
+ )
)
+
if error:
error.hit_count += 1
else:
@@ -50,6 +40,7 @@ def _catch_500_error(self, request):
"request_method": request_method,
"hit_count": 1,
"website_id": website_id,
+ "http_param": http_param or "",
}
)
self.env.cr.commit()
diff --git a/website_catch_500/models/website_500_errors.py b/website_catch_500/models/website_500_errors.py
index 8e52dd56..2de21c00 100644
--- a/website_catch_500/models/website_500_errors.py
+++ b/website_catch_500/models/website_500_errors.py
@@ -21,6 +21,7 @@ class Website500Errors(models.Model):
],
string="Request Method",
)
+ http_param = fields.Char(string="HTTP Request Param")
hit_count = fields.Integer(string="Hit Count")
website_id = fields.Many2one(
comodel_name="website",
diff --git a/website_catch_500/views/website_500_errors_views.xml b/website_catch_500/views/website_500_errors_views.xml
index 73fff738..b96d3fbe 100644
--- a/website_catch_500/views/website_500_errors_views.xml
+++ b/website_catch_500/views/website_500_errors_views.xml
@@ -5,10 +5,10 @@