From d0160c3b7e42a18e36c7e3e1b8c2c0eae7b93618 Mon Sep 17 00:00:00 2001 From: Cristian Libotean Date: Thu, 2 Mar 2023 10:56:51 +0200 Subject: [PATCH] Added contains() and lacks() comparison methods suggested in issue #43. --- odata/property.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/odata/property.py b/odata/property.py index 35814ed..2c7fc02 100644 --- a/odata/property.py +++ b/odata/property.py @@ -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): """