# HG changeset patch # User Denis Laxalde # Date 1382599245 -7200 # Node ID 178791fde195431989e0bfd54141acb87811ddc0 # Parent 95119045ffb520591e9e74dae16fd207f15dcfed [book] Improve match_rtype selector docstring and "Relation modification related events" section diff -r 95119045ffb5 -r 178791fde195 server/hook.py --- a/server/hook.py Thu Oct 24 11:48:13 2013 +0200 +++ b/server/hook.py Thu Oct 24 09:20:45 2013 +0200 @@ -169,7 +169,10 @@ * `after_add_relation`, `after_delete_relation` -Take note that relations can be added or deleted, but not updated. +Specific selectors are shipped for these kinds of events, see in particular +:class:`~cubicweb.server.hook.match_rtype`. + +Also note that relations can be added or deleted, but not updated. Non data events ~~~~~~~~~~~~~~~ @@ -439,11 +442,13 @@ class match_rtype(ExpectedValuePredicate): - """accept if parameters specified as initializer arguments are specified - in named arguments given to the predicate + """accept if the relation type is found in expected ones. Optional + named parameters `frometypes` and `toetypes` can be used to restrict + target subject and/or object entity types of the relation. - :param \*expected: parameters (eg `basestring`) which are expected to be - found in named arguments (kwargs) + :param \*expected: possible relation types + :param frometypes: candidate entity types as subject of relation + :param toetypes: candidate entity types as object of relation """ def __init__(self, *expected, **more): self.expected = expected