Skip to content

Commit

Permalink
Merge 6c2af9c into d946e4a
Browse files Browse the repository at this point in the history
  • Loading branch information
terry-xuan-gao committed Apr 1, 2023
2 parents d946e4a + 6c2af9c commit b46067d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion casbin/persist/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,25 @@ def load_policy_line(line, model):
if line[:1] == "#":
return

tokens = [token.strip() for token in line.split(",")]
stack = []
tokens = []
for c in line:
if c == "[":
stack.append(c)
tokens[-1] += "["
elif c == "]":
stack.pop()
tokens[-1] += "]"
elif c == "," and len(stack) == 0:
tokens.append("")
else:
if len(tokens) == 0:
tokens.append(c)
else:
tokens[-1] += c

tokens = [x.strip() for x in tokens]

key = tokens[0]
sec = key[0]

Expand Down

0 comments on commit b46067d

Please sign in to comment.