[book] Improve match_rtype selector docstring and "Relation modification related events" section stable
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 24 Oct 2013 09:20:45 +0200
branchstable
changeset 9314 178791fde195
parent 9313 95119045ffb5
child 9315 5298cfb132e6
[book] Improve match_rtype selector docstring and "Relation modification related events" section
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