cubicweb/test/data/rqlexpr_on_computedrel.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Thu, 14 Mar 2019 12:08:37 +0100
changeset 12508 a8c1ea390400
parent 11057 0b59724cb3f2
permissions -rw-r--r--
Drop most of deprecated code As in previous changesets, most code has been deprecated since a very long time. This changeset concerns "core" cubicweb modules (e.g. "server", "appobjects") for which it's not easy to handle change atomically. In cubicweb/server/querier.py, we adjust empty_rset() function as a result of "rqlst" argument of ResultSet being dropped. (There was no use of the keyword argument anyways.)

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