[BUG] bool type error
See original GitHub issueI believe I have found a bug in drf-access-policy
. During some requests I receive the following 500 error:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 497, in dispatch
self.initial(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 415, in initial
self.check_permissions(request)
File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 332, in check_permissions
if not permission.has_permission(request, self):
File "/usr/local/lib/python3.8/site-packages/rest_access_policy/access_policy.py", line 26, in has_permission
return self._evaluate_statements(statements, request, view, action)
File "/usr/local/lib/python3.8/site-packages/rest_access_policy/access_policy.py", line 62, in _evaluate_statements
matched = self._get_statements_matching_context_conditions(
File "/usr/local/lib/python3.8/site-packages/rest_access_policy/access_policy.py", line 181, in _get_statements_matching_context_conditions
passed = bool(boolExpr.parseString(condition)[0])
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1943, in parseString
loc, tokens = self._parse(instring, 0)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4254, in parseImpl
ret = e._parse(instring, loc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4254, in parseImpl
ret = e._parse(instring, loc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4254, in parseImpl
ret = e._parse(instring, loc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4069, in parseImpl
loc, exprtokens = e._parse(instring, loc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4254, in parseImpl
ret = e._parse(instring, loc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4069, in parseImpl
loc, exprtokens = e._parse(instring, loc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4052, in parseImpl
loc, resultlist = self.exprs[0]._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4254, in parseImpl
ret = e._parse(instring, loc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4462, in parseImpl
return self.expr._parse(instring, loc, doActions, callPreParse=False)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1683, in _parseNoCache
loc, tokens = self.parseImpl(instring, preloc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 4254, in parseImpl
ret = e._parse(instring, loc, doActions)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1716, in _parseNoCache
tokens = fn(instring, tokensStart, retTokens)
File "/usr/local/lib/python3.8/site-packages/pyparsing.py", line 1316, in wrapper
ret = func(*args[limit[0]:])
TypeError: __init__() missing 1 required positional argument: 't'
The error seems to stem from File "/usr/local/lib/python3.8/site-packages/rest_access_policy/access_policy.py", line 181, in _get_statements_matching_context_conditions
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Bug: Boolean type literals misbehaving · Issue #10432
Types of property 'success' are incompatible. Type 'boolean' is not assignable to type 'false'. result.ts(8,16): error TS2322: Type ...
Read more >ERROR! Unexpected Exception, this is probably a bug
I've got an error with Ansible, that I don't understand: ERROR! Unexpected Exception, this is probably a bug: argument of type 'bool' is...
Read more >An error from a simple test for BOOL type in visual C++
Try adding #include <windows.h> before the windef.h header. But unless you need to interact with code using BOOL you should probably use the ......
Read more >1571292 - error: '~' on an expression of type bool [-Werror= ...
Fails with gcc 8 and -Wall on /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BlocksRingBuffer.h:333:26: error: '~' on an expression of ...
Read more >Bug #1778626 “cannot convert 'bool' to 'boolean' in return”
I get rid of the error by either changing the return type from boolean to bool or changing uses of "return true;" to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks 🙂. I’ll plan to do the 1.0 update later today, it’s pretty minor, the main thing is communicating the breaking change in the docs.
On Mon, Jul 5, 2021, 4:03 PM Michael Honaker @.***> wrote:
@rsinger86 just checked and it works perfectly!! Will let you know if I encounter the error again. Thank you again for all your work.