-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
When trying to use 3 @connect operators, I receive Syntax Error. For example, given this field configuration:
author_note:
"""Contains public note."""
derived:
@parse_first('_public_note', '_private_note', '_curators_note')
@connect('_public_note', sync_notes)
@connect('_private_note', sync_notes)
@connect('_curators_note', sync_notes)
@only_if('_public_note' in self or '_private_note' in self
or '_curators_note' in self)
sum_notes(self, '_public_note', '_private_note', '_curators_note')Note that:
- Changing the order of the decorators doesn't help
- Changing
only_ifcall to one line doesn't help - Removing any of the
@connects helps
This is the pyparsing grammar definition for derived fields.
der_calc_body = (Optional(field_decorators).setResultsName('decorators') +
PYTHON_ALLOWED_EXPR)
derived = (
Keyword('derived:').suppress() +
indentedBlock(der_calc_body, indent_stack)
).setParseAction(lambda toks: {
'source_format': 'derived',
'source_tags': None,
'function': compile(toks[-1].strip(), '', 'eval'),
'type': 'derived',
'decorators': toks.decorators.asDict()}).setResultsName('derived_def')
calculated = (
Keyword('calculated:').suppress() +
indentedBlock(der_calc_body, indent_stack)
).setParseAction(lambda toks: {
'source_format': 'calculated',
'source_tags': None,
'function': compile(toks[-1].strip(), '', 'eval'),
'type': 'calculated',
'decorators': toks.decorators.asDict()
}).setResultsName('calculated_def')Which looks fine. No idea where does the error come from.