def dispatch(self, request, *args, **kwargs):
    key = request.session.get('gate_key', None)
    key_test_result = self.get_lock_test_func()(key)
    if (not key_test_result):
        return self.handle_no_permission()
    return super().dispatch(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs):
    key = request.session.get('gate_key', None)
    key_test_result = self.get_lock_test_func()(key)
    if (not key_test_result):
        return self.handle_no_permission()
    return super().dispatch(request, *args, **kwargs)