def valid_field_in_graph(arch):
- """A `graph` must have `string` attribute and an immediate node of `graph` view must be `field`."""
- if arch.xpath('//graph[not (@string)]'):
- return False
+ """ Children of ``graph`` can only be ``field`` """
for child in arch.xpath('/graph/child::*'):
if child.tag != 'field':
return False
def valid_field_in_tree(arch):
- """A `tree` must have `string` attribute and an immediate node of `tree` view must be `field` or `button`."""
- if arch.xpath('//tree[not (@string)]'):
- return False
+ """ Children of ``tree`` view must be ``field`` or ``button``."""
for child in arch.xpath('/tree/child::*'):
if child.tag not in ('field', 'button'):
return False
def valid_att_in_field(arch):
- """A `name` attribute must be in a `field` node."""
- return not arch.xpath('//field[not (@name)]')
+ """ ``field`` nodes must all have a ``@name`` """
+ return not arch.xpath('//field[not(@name)]')
def valid_att_in_label(arch):
- """A `for` and `string` attribute must be on a `label` node."""
- return not arch.xpath('//label[not ((@for) or (@string))]')
+ """ ``label`` nodes must have a ``@for`` or a ``@string`` """
+ return not arch.xpath('//label[not(@for or @string)]')
def valid_att_in_form(arch):