Skip to content

Commit 8695a52

Browse files
authored
Merge pull request #4 from VidScale/allow-to-reload-model-and-enforcer-and-config
Fixed bugs to allow reinit model and enforcer in async mode
2 parents 3ad2252 + 2f7d452 commit 8695a52

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

casbin/config/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def add_config(self, section, option, value):
4141
self._data[section][option] = value
4242

4343
def _parse(self, fname):
44-
with open(fname, 'rb') as f:
44+
with open(fname, 'r') as f:
4545
self._parse_buffer(f)
4646

4747
def _parse_buffer(self, f):
@@ -61,7 +61,7 @@ def _parse_buffer(self, f):
6161
if len(buf) > 0:
6262
self._write(section, line_num, buf)
6363
break
64-
line = line.strip().decode()
64+
line = line.strip()
6565

6666
if '' == line or self.DEFAULT_COMMENT == line[0:1] or self.DEFAULT_COMMENT_SEM == line[0:1]:
6767
can_write = True

casbin/model/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Model(Policy):
7-
model = dict()
87

98
section_name_map = {
109
'r': 'request_definition',

casbin/model/policy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33

44
class Policy:
5-
model = dict()
5+
def __init__(self):
6+
self.model = {}
67

78
def build_role_links(self, rm):
89
if "g" not in self.model.keys():

casbin/util/expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from simpleeval import simple_eval
22

33

4-
def evaluate(exp_string, parameters=dict(), functions=dict()):
4+
def evaluate(exp_string, parameters=None, functions=None):
55
exp_string = exp_string.replace("&&", "and")
66
exp_string = exp_string.replace("||", "or")
77
return simple_eval(exp_string, functions=functions, names=parameters)

0 commit comments

Comments
 (0)