doc/book/en/devrepo/repo/hooks.rst
changeset 6162 76bd320c5ace
parent 6147 95c604ec89bf
parent 6152 6824f8b61098
child 6366 1806148d6ce8
--- a/doc/book/en/devrepo/repo/hooks.rst	Thu Aug 26 10:29:32 2010 +0200
+++ b/doc/book/en/devrepo/repo/hooks.rst	Thu Aug 26 11:45:57 2010 +0200
@@ -25,22 +25,22 @@
 .. sourcecode:: python
 
    from cubicweb import ValidationError
-   from cubicweb.selectors import implements
+   from cubicweb.selectors import is_instance
    from cubicweb.server.hook import Hook
 
    class PersonAgeRange(Hook):
         __regid__ = 'person_age_range'
         events = ('before_add_entity', 'before_update_entity')
-        __select__ = Hook.__select__ & implements('Person')
+        __select__ = Hook.__select__ & is_instance('Person')
 
         def __call__(self):
 	    if 'age' in self.entity.cw_edited:
-		if 0 >= self.entity.age <= 120:
-		   return
+                if 0 <= self.entity.age <= 120:
+                   return
 		msg = self._cw._('age must be between 0 and 120')
 		raise ValidationError(self.entity.eid, {'age': msg})
 
-In our example the base `__select__` is augmented with an `implements` selector
+In our example the base `__select__` is augmented with an `is_instance` selector
 matching the desired entity type.
 
 The `events` tuple is used specify that our hook should be called before the