--- a/schema.py Wed Dec 02 11:57:38 2009 +0100
+++ b/schema.py Wed Dec 02 12:52:55 2009 +0100
@@ -559,11 +559,19 @@
"""
def __init__(self, restriction, mainvars=None):
- self.restriction = restriction
+ self.restriction = normalize_expression(restriction)
if mainvars is None:
mainvars = guess_rrqlexpr_mainvars(restriction)
+ else:
+ normmainvars = []
+ for mainvar in mainvars.split(','):
+ mainvar = mainvar.strip()
+ if not mainvar.isalpha():
+ raise Exception('bad mainvars %s' % mainvars)
+ normmainvars.append(mainvar)
+ assert mainvars, 'bad mainvars %s' % mainvars
+ mainvars = ','.join(sorted(normmainvars))
self.mainvars = mainvars
- assert not ';' in mainvars # XXX check mainvars as for RQLExpression?
def serialize(self):
# start with a comma for bw compat, see below