Giter Site home page Giter Site logo

mongo_filter_evaluator's People

Contributors

zlebnik avatar

Stargazers

 avatar

Forkers

klwilson227

mongo_filter_evaluator's Issues

RuntimeError: maximum recursion depth exceeded

  • Mongo Filter Evaluator version: 1.0
  • Python version: 2.7.4
  • Operating System: Centos7

Description

d = {... any data will do ...}
f = {"$and": [{any first filter}, {}]
DataConditionEvaluator(f,d).evaluate()

Leads to stack overrun...recursive calls.

Describe what you were trying to get done.

In the automated building for filter conditions it is common to use a {} empty filter when one part of the generation does not apply vs. simply removing the filter from the $and condition itself. This way one can see that a filter was returned for that part of the and however, it was a empty filter which should pass. Thus the $and logic remains syntactically correct. For example, a user supplied filter on the left and a entitlement filter on the right. If the user is entitled to see everything then syntactically a {} may be used as a replacement.

Tell us what happened, what went wrong, and what you expected to happen.

Exception RuntimeError: maximum recursion depth exceeded

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

def test_filter_stream_and2e(self):
f = {'$and': [{'blah': 0.3}, {}]}
d = {u'blah': 0.3}
DataConditionEvaluator(f, d).evaluate()

File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 52, in c_and
for condition in body
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 52, in
for condition in body
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 27, in evaluate
return self.evaluate_logic('$and', condition)
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/evaluator.py", line 98, in evaluate_logic
return getattr(self, 'c_%s' % keyword[1:])(body)
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 47, in c_and
for (condition_keyword, condition_body) in body.items()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 47, in
for (condition_keyword, condition_body) in body.items()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 36, in evaluate_condition
for op_keyword, op_body in body.items()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 36, in
for op_keyword, op_body in body.items()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/evaluator.py", line 103, in evaluate_function
value=body,
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/evaluator.py", line 13, in wrap_method
return (field in self.data) and f(self, field, value)
RuntimeError: maximum recursion depth exceeded

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.