# HG changeset patch # User Sylvain Thénault # Date 1284471181 -7200 # Node ID d992176d17b7761cedb48ce2f583936c020eaa83 # Parent fd8fb9661c57b44d0c5e1c4334fcab4eed21ccce [schema] ensure DISTINCT is displayed for constraint using it, this ease debugging diff -r fd8fb9661c57 -r d992176d17b7 schema.py --- a/schema.py Tue Sep 14 08:49:29 2010 +0200 +++ b/schema.py Tue Sep 14 15:33:01 2010 +0200 @@ -613,6 +613,7 @@ class BaseRQLConstraint(BaseConstraint): """base class for rql constraints """ + distinct_query = None def __init__(self, restriction, mainvars=None): self.restriction = normalize_expression(restriction) @@ -652,8 +653,12 @@ pass # this is a vocabulary constraint, not enforce XXX why? def __str__(self): - return '%s(Any %s WHERE %s)' % (self.__class__.__name__, self.mainvars, - self.restriction) + if self.distinct_query: + selop = 'Any' + else: + selop = 'DISTINCT Any' + return '%s(%s %s WHERE %s)' % (self.__class__.__name__, selop, + self.mainvars, self.restriction) def __repr__(self): return '<%s @%#x>' % (self.__str__(), id(self))