test/data/rqlexpr_on_computedrel.py
author Rémi Cardona <remi.cardona@logilab.fr>
Fri, 11 Sep 2015 18:01:36 +0200
changeset 10665 79ff784cd8af
parent 10554 c39749d14c53
child 10907 9ae707db5265
permissions -rw-r--r--
[py3k] introduce cubicweb._ (related to #7589459) The end goal is to stop relying on '_' being in the builtin scope. In the mean time, deprecate the builtin '_' so that consumers are warned.

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'),)}