equal
deleted
inserted
replaced
167 |
167 |
168 On those events, you can still get the original relation by issuing a rql query. |
168 On those events, you can still get the original relation by issuing a rql query. |
169 |
169 |
170 * `after_add_relation`, `after_delete_relation` |
170 * `after_add_relation`, `after_delete_relation` |
171 |
171 |
172 Take note that relations can be added or deleted, but not updated. |
172 Specific selectors are shipped for these kinds of events, see in particular |
|
173 :class:`~cubicweb.server.hook.match_rtype`. |
|
174 |
|
175 Also note that relations can be added or deleted, but not updated. |
173 |
176 |
174 Non data events |
177 Non data events |
175 ~~~~~~~~~~~~~~~ |
178 ~~~~~~~~~~~~~~~ |
176 |
179 |
177 Hooks called on server start/maintenance/stop event (e.g. |
180 Hooks called on server start/maintenance/stop event (e.g. |
437 def __iter__(self): |
440 def __iter__(self): |
438 return iter(chain(*self.iterators)) |
441 return iter(chain(*self.iterators)) |
439 |
442 |
440 |
443 |
441 class match_rtype(ExpectedValuePredicate): |
444 class match_rtype(ExpectedValuePredicate): |
442 """accept if parameters specified as initializer arguments are specified |
445 """accept if the relation type is found in expected ones. Optional |
443 in named arguments given to the predicate |
446 named parameters `frometypes` and `toetypes` can be used to restrict |
444 |
447 target subject and/or object entity types of the relation. |
445 :param \*expected: parameters (eg `basestring`) which are expected to be |
448 |
446 found in named arguments (kwargs) |
449 :param \*expected: possible relation types |
|
450 :param frometypes: candidate entity types as subject of relation |
|
451 :param toetypes: candidate entity types as object of relation |
447 """ |
452 """ |
448 def __init__(self, *expected, **more): |
453 def __init__(self, *expected, **more): |
449 self.expected = expected |
454 self.expected = expected |
450 self.frometypes = more.pop('frometypes', None) |
455 self.frometypes = more.pop('frometypes', None) |
451 self.toetypes = more.pop('toetypes', None) |
456 self.toetypes = more.pop('toetypes', None) |