equal
deleted
inserted
replaced
97 |
97 |
98 .. sourcecode:: python |
98 .. sourcecode:: python |
99 |
99 |
100 from cubicweb.server.hook import Hook, DataOperationMixIn, Operation, match_rtype |
100 from cubicweb.server.hook import Hook, DataOperationMixIn, Operation, match_rtype |
101 |
101 |
102 def check_cycle(self, session, eid, rtype, role='subject'): |
102 def check_cycle(session, eid, rtype, role='subject'): |
103 parents = set([eid]) |
103 parents = set([eid]) |
104 parent = session.entity_from_eid(eid) |
104 parent = session.entity_from_eid(eid) |
105 while parent.related(rtype, role): |
105 while parent.related(rtype, role): |
106 parent = parent.related(rtype, role)[0] |
106 parent = parent.related(rtype, role)[0] |
107 if parent.eid in parents: |
107 if parent.eid in parents: |