I am trying to restrict all blogs access to only authenticated users, I am using the following class to override the blog routes:
class RestrictWebBLog(WebsiteBlog):
@http.route(auth='user')
def blogs(self):
return super(RestrictWebBLog, self).blogs()
@http.route(auth='user')
def blog_post(self):
return super(RestrictWebBLog, self).blog_post()
@http.route(auth='user')
def blog(self):
return super(RestrictWebBLog, self).blog()
It seems to work, because login is required when trying to access any blog, but after entering credentials, the following error appears:
500: Internal Server Error
Error message:
blog() got an unexpected keyword argument 'blog'Traceback (most recent call last): File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 203, in _dispatch result = request.dispatch() File "/opt/odoo/odoo/http.py", line 833, in dispatch r = self._call_function(**self.params) File "/opt/odoo/odoo/http.py", line 344, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo/odoo/service/model.py", line 97, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo/odoo/http.py", line 337, in checked_call result = self.endpoint(*a, **kw) File "/opt/odoo/odoo/http.py", line 939, in __call__ return self.method(*args, **kw) File "/opt/odoo/odoo/http.py", line 517, in response_wrap response = f(*args, **kw) TypeError: blog() got an unexpected keyword argument 'blog'
Odoo Web Controller: http://learnopenerp.blogspot.com/2018/08/odoo-web-controller.html