refactor(minor): Use pluck & better var naming
This commit is contained in:
parent
0410a88aea
commit
cb66e6508d
1 changed files with 3 additions and 3 deletions
|
|
@ -353,10 +353,10 @@ def get_roles(user=None, with_standard=True):
|
|||
return frappe.get_all("Role", pluck="name") # return all available roles
|
||||
else:
|
||||
table = DocType("Has Role")
|
||||
result = frappe.qb.from_(table).where(
|
||||
roles = frappe.qb.from_(table).where(
|
||||
(table.parent == user) & (table.role.notin(["All", "Guest"]))
|
||||
).select(table.role).run()
|
||||
return [r[0] for r in result] + ['All', 'Guest']
|
||||
).select(table.role).run(pluck=True)
|
||||
return roles + ['All', 'Guest']
|
||||
|
||||
roles = frappe.cache().hget("roles", user, get)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue