Skip to content

Commit

Permalink
Added contains() and lacks() comparison methods suggested in issue #43.
Browse files Browse the repository at this point in the history
  • Loading branch information
eblis committed Mar 6, 2023
1 parent 2101d79 commit b9497ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions odata/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ def endswith(self, value):
value = self.escape_value(value)
return u'endswith({0}, {1})'.format(self.name, value)

def contains(self, value):
"""Extend the StringProperty with contains method"""
value = self.escape_value(value)
return u'contains({0}, {1})'.format(self.name, value)

def lacks(self, value):
"""Does not contain"""
value = self.escape_value(value)
return u'not(contains({0}, {1}))'.format(self.name, value)


class IntegerProperty(PropertyBase):
"""
Expand Down

0 comments on commit b9497ce

Please sign in to comment.