Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Website

Entity: website.rewrite

Compute Method: _compute_is_url_from_exist

View 20.0
Inputs Method Outputs
  • url_from
  • redirect_type
+ for rewrite in self:
+             exists = False
+             if rewrite.url_from and rewrite.redirect_type in ['301', '302']:
+                 url = rewrite.url_from.rstrip('/')
+                 exists = self.env['website.page'].search_count([('url', '=', rewrite.url_from)], limit=1) > 0
+                 if not exists:
+                     try:
+                         self.env['ir.http']._match(url)
+                         exists = True
+                     except werkzeug.exceptions.NotFound:
+                         exists = False
+ 
+             rewrite.is_url_from_exist = exists
  • is_url_from_exist

Back to entity