Skip to content

Conversation

@Rhishikesh1997
Copy link

@Rhishikesh1997 Rhishikesh1997 commented Jan 18, 2022

The Python ast module, which this library depends on has been changed in more recent versions of Python. For sure 3.8, and possibly 3.7 or earlier. The ast parser assigns a value of "Constant" to quoted strings and constant numeric values to the right and left side of the comparison operator inside a comparison expression. When this is not handled by the resolve() function inside a AstHandler class as the string "Constant" is appended to "handle_" and then the getattr() method fails because none of the field handler functions have a handle_Constant() function.
So i have added the handle_Constant() function inside a ConstantField class and pass this class as argument inside GenericField class. This handle_constant () function converts constants into a string.

So with this we are able to convert python expression to a pymongo expression even with python versions greater than 3.7

@Rhishikesh1997 Rhishikesh1997 changed the title adding constant handler for for comaptibality of python versions > 3.7 adding constant handler for comaptibality of pql with python versions > 3.7 Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant