Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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 https://github.com/cbmi/avocado/wiki/Validation
  • Loading branch information...
commit 7fb7fa53b9827af51d9b29afd10c6fee071e2042 1 parent 0939635
@bruth bruth authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 avocado/query/parsers/datacontext.py
View
7 avocado/query/parsers/datacontext.py
@@ -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'] = cxt.name
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']
else:
raise ValidationError(u'Object neither a branch nor condition: {0}'.format(attrs))
Please sign in to comment.
Something went wrong with that request. Please try again.