Browse files

Add language directly to node

This is harmless and more accessible for downstream clients so they do
not have to map the validated node to the corresponding language node.

This is one of the components in migrating to supporting the new
validation implementation. See
  • Loading branch information...
1 parent 0939635 commit 7fb7fa53b9827af51d9b29afd10c6fee071e2042 @bruth bruth committed May 7, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 avocado/query/parsers/
@@ -207,6 +207,7 @@ def validate(attrs, **context):
except DataContext.DoesNotExist:
raise ValidationError(u'DataContext "{0}" does not exist.'.format(attrs['id']))
validate(cxt.json, **context)
+ attrs['language'] =
elif is_condition(attrs):
from avocado.models import DataField, DataConcept
@@ -223,8 +224,12 @@ def validate(attrs, **context):
except ObjectDoesNotExist, e:
raise ValidationError(e.message)
field.validate(operator=attrs['operator'], value=attrs['value'])
+ node = parse(attrs, **context)
+ attrs['language'] = node.language['language']
elif is_branch(attrs):
- map(lambda x: validate(x), attrs['children'])
+ map(lambda x: validate(x, **context), attrs['children'])
+ node = parse(attrs, **context)
+ attrs['language'] = node.language['children']
raise ValidationError(u'Object neither a branch nor condition: {0}'.format(attrs))

0 comments on commit 7fb7fa5

Please sign in to comment.