Improve denied output
This commit is contained in:
parent
c4f17dd5fb
commit
0eda404732
|
@ -320,16 +320,15 @@ def query_results(
|
|||
denied_t = hash_lookup(request.user, tags)
|
||||
denied.extend(denied_t)
|
||||
|
||||
message = []
|
||||
message = "Permission denied: "
|
||||
for x in denied:
|
||||
if isinstance(x, SearchDenied):
|
||||
message.append(f"Permission denied to search by {x.key}: {x.value}")
|
||||
message += f"Search({x.key}: {x.value}) "
|
||||
elif isinstance(x, LookupDenied):
|
||||
message.append(f"Tag {x.key}: {x.value} not expected here. Nice try.")
|
||||
message += f"Lookup({x.key}: {x.value}) "
|
||||
if denied:
|
||||
print("DENIED DICT", message)
|
||||
message = [f"{i}" for i in message]
|
||||
message = "\n".join(message)
|
||||
#message = [f"{i}" for i in message]
|
||||
#message = "\n".join(message)
|
||||
message_class = "danger"
|
||||
return {"message": message, "class": message_class}
|
||||
|
||||
|
|
Loading…
Reference in New Issue