def __init__(self, arg1, arg2=Undef, on=Undef): # http://www.postgresql.org/docs/8.1/interactive/explicit-joins.html if arg2 is Undef: self.left = Undef self.right = arg1 self.on = on elif not isinstance(arg2, Expr) or isinstance(arg2, (FromExpr, Alias)): self.left = arg1 self.right = arg2 self.on = on else: self.left = Undef self.right = arg1 self.on = arg2 if on is not Undef: raise ExprError("Improper join arguments: (%r, %r, %r)" % (arg1, arg2, on))
def endswith(self, suffix): if not isinstance(suffix, unicode): raise ExprError("Expected unicode argument, got %r" % type(suffix)) pattern = u"%" + suffix.translate(like_escape) return Like(self, pattern, u"!")
def contains_string(self, substring): if not isinstance(substring, unicode): raise ExprError("Expected unicode argument, got %r" % type(substring)) pattern = u"%" + substring.translate(like_escape) + u"%" return Like(self, pattern, u"!")
def startswith(self, prefix): if not isinstance(prefix, unicode): raise ExprError("Expected unicode argument, got %r" % type(prefix)) pattern = prefix.translate(like_escape) + u"%" return Like(self, pattern, u"!")