Wrong code for the CSRF protection in the CubicWeb documentation
In the CubicWeb documentation for the CRSF protection, there is an error in the last code for the “Disable CSRF for a CubicWeb View” chapter:
from cubicweb.web.views.basecontrollers import ViewController
class ControllerWithCSRFCheckDisabled(ViewController):
require_csrf = False
def registration_callback(vreg):
self.vreg.register_and_replace(ControllerWithCSRFCheckDisabled, ViewController)
The last line use the self
variable, but this is a function and not a method of class.