# HG changeset patch # User Sylvain Thénault # Date 1259754775 -3600 # Node ID 0d592677e55fd11cd415fd89786de6622fbc5ad3 # Parent 15d9d47f5434ecd70dafe7d343318b50c3c80514 nicer mainvars/expression handling when initializing rql constraints diff -r 15d9d47f5434 -r 0d592677e55f schema.py --- 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