policies/engine: add more verbosity
This commit is contained in:
		| @ -74,9 +74,10 @@ class PolicyEngine: | ||||
|         for binding in self._iter_bindings(): | ||||
|             self._check_policy_type(binding.policy) | ||||
|             policy = binding.policy | ||||
|             cached_policy = cache.get(cache_key(binding, self.request.user), None) | ||||
|             key = cache_key(binding, self.request.user) | ||||
|             cached_policy = cache.get(key, None) | ||||
|             if cached_policy and self.use_cache: | ||||
|                 LOGGER.debug("P_ENG: Taking result from cache", policy=policy) | ||||
|                 LOGGER.debug("P_ENG: Taking result from cache", policy=policy, cache_key=key) | ||||
|                 self.__cached_policies.append(cached_policy) | ||||
|                 continue | ||||
|             LOGGER.debug("P_ENG: Evaluating policy", policy=policy) | ||||
| @ -103,7 +104,7 @@ class PolicyEngine: | ||||
|             x.result for x in self.__processes if x.result | ||||
|         ] | ||||
|         for result in process_results + self.__cached_policies: | ||||
|             LOGGER.debug("P_ENG: result", passing=result.passing) | ||||
|             LOGGER.debug("P_ENG: result", passing=result.passing, messages=result.messages) | ||||
|             if result.messages: | ||||
|                 messages += result.messages | ||||
|             if not result.passing: | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer