cubicweb/test/data/rqlexpr_on_computedrel.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 30 Jan 2017 10:18:31 +0100
changeset 11936 46a0366a32af
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[devtools] Skip computed relations when attempting to auto-populate test database Fix the automatic database population underlying automatic test to avoid attempt to create computed relations.

from yams.buildobjs import ComputedRelation, EntityType, RelationDefinition
from cubicweb.schema import RRQLExpression

class Subject(EntityType):
    pass

class Object(EntityType):
    pass

class relation(RelationDefinition):
    subject = 'Subject'
    object = 'Object'

class computed(ComputedRelation):
    rule = 'S relation O'
    __permissions__ = {'read': (RRQLExpression('S is ET'),)}