New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error message if search query tests for NULL using comparison operators #299

Merged
merged 4 commits into from Jul 16, 2014

Conversation

Projects
None yet
2 participants
@mjfroehlich
Contributor

mjfroehlich commented Mar 23, 2014

One of our API users made failing search queries testing for NULL using comparison operators.
A log message "To compare a value to NULL, use the is_null/is_not_null operators" would have saved me some time understanding what's going on.

@@ -145,6 +145,9 @@ def test_operators(self):
d = dict(filters=[dict(name='birth_date', op='is_not_null')])
result = search(self.session, self.Person, d)
assert result.count() == 1
d = dict(filters=[dict(name='birth_date', op='eq', val=None)])
assert_raises(TypeError, search, self.session, self.Person, d)

This comment has been minimized.

@jfinkels

jfinkels Jul 15, 2014

Owner

Remove this blank line.

@@ -342,7 +342,9 @@ def _create_operation(model, fieldname, operator, argument, relation=None):
if numargs == 1:
return opfunc(field)
if argument is None:
raise TypeError
msg = ('To compare a value to NULL, use the is_null/is_not_null '
'operators.')

This comment has been minimized.

@jfinkels

jfinkels Jul 15, 2014

Owner

String continuation should start at the same column as the beginning of the string literal on the previous line.

Martin Froehlich
@mjfroehlich

This comment has been minimized.

Contributor

mjfroehlich commented Jul 16, 2014

Thanks for the feedback, implemented.

jfinkels added a commit that referenced this pull request Jul 16, 2014

Merge pull request #299 from mjfroehlich/null_comparison_error_message
Show error message if search query tests for NULL using comparison operators

@jfinkels jfinkels merged commit 74304d1 into jfinkels:master Jul 16, 2014

1 check failed

continuous-integration/travis-ci The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment