mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 23:47:16 +02:00
Fixed a bug in lockhandler when entering a lock string containing upper-case AND/OR/NOT as part of a word (such as MAYOR). Thanks to lagos for suggesting the fix! Resolves Issue 303.
This commit is contained in:
parent
3f01ab8006
commit
32b6becd33
1 changed files with 4 additions and 2 deletions
|
|
@ -211,7 +211,9 @@ class LockHandler(object):
|
|||
|
||||
# parse the lock functions and separators
|
||||
funclist = _RE_FUNCS.findall(rhs)
|
||||
evalstring = rhs.replace('AND','and').replace('OR','or').replace('NOT','not')
|
||||
evalstring = rhs
|
||||
for pattern in ('AND', 'OR', 'NOT'):
|
||||
evalstring = re.sub(r"\b%s\b" % pattern, pattern.lower(), evalstring)
|
||||
nfuncs = len(funclist)
|
||||
for funcstring in funclist:
|
||||
funcname, rest = (part.strip().strip(')') for part in funcstring.split('(', 1))
|
||||
|
|
@ -226,7 +228,7 @@ class LockHandler(object):
|
|||
if len(lock_funcs) < nfuncs:
|
||||
continue
|
||||
try:
|
||||
# purge the eval string of any superfluos items, then test it
|
||||
# purge the eval string of any superfluous items, then test it
|
||||
evalstring = " ".join(_RE_OK.findall(evalstring))
|
||||
eval(evalstring % tuple(True for func in funclist), {}, {})
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue