# HG changeset patch # User Aurelien Campeas # Date 1271179366 -7200 # Node ID 40f53867e332709c3db8f55b4f4b364c57921ebd # Parent cd033d2f4229107098ae1470d86ea0f16ff344ab [doc/book] misc fixes/enhancements & notes diff -r cd033d2f4229 -r 40f53867e332 doc/book/en/development/devrepo/hooks.rst --- a/doc/book/en/development/devrepo/hooks.rst Tue Apr 13 19:21:20 2010 +0200 +++ b/doc/book/en/development/devrepo/hooks.rst Tue Apr 13 19:22:46 2010 +0200 @@ -116,7 +116,9 @@ Using dataflow Hooks -------------------- -XXX blabla +Dataflow hooks either automate data operations or maintain the +consistency of the data model. In the later case, we must use a +specific exception named ValidationError Validation Errors ~~~~~~~~~~~~~~~~~ @@ -136,6 +138,8 @@ an end-user facing message (hence properly translated) relating the problem. +An entity hook +~~~~~~~~~~~~~~ We will use a very simple example to show hooks usage. Let us start with the following schema. @@ -145,9 +149,6 @@ class Person(EntityType): age = Int(required=True) -An entity hook -~~~~~~~~~~~~~~ - We would like to add a range constraint over a person's age. Let's write an hook. It shall be placed into mycube/hooks.py. If this file were to grow too much, we can easily have a mycube/hooks/... package @@ -284,6 +285,8 @@ .. sourcecode:: python + from cubicweb.server.hook import set_operation + class CheckSubsidiaryCycleHook(Hook): __regid__ = 'check_no_subsidiary_cycle' events = ('after_add_relation',) @@ -291,7 +294,7 @@ def __call__(self): set_operation(self._cw, 'subsidiary_cycle_detection', self.eidto, - CheckCycleOp, rtype=self.rtype) + CheckSubsidiaryCycleOp, rtype=self.rtype) class CheckSubsidiaryCycleOp(Operation): diff -r cd033d2f4229 -r 40f53867e332 doc/book/en/development/devweb/request.rst --- a/doc/book/en/development/devweb/request.rst Tue Apr 13 19:21:20 2010 +0200 +++ b/doc/book/en/development/devweb/request.rst Tue Apr 13 19:22:46 2010 +0200 @@ -1,5 +1,3 @@ - - The `Request` class (`cubicweb.web`) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -57,3 +55,7 @@ today). For the views or others that are executed on the server side, most of the interface of `Request` is defined in the session associated to the client. + + +XXX autoclass ! +XXX create_entity diff -r cd033d2f4229 -r 40f53867e332 doc/book/en/development/migration.rst --- a/doc/book/en/development/migration.rst Tue Apr 13 19:21:20 2010 +0200 +++ b/doc/book/en/development/migration.rst Tue Apr 13 19:22:46 2010 +0200 @@ -74,12 +74,12 @@ if the user answers yes, false otherwise (always returns true in non-interactive mode) -* the function `_`, it is equivalent to `unicode` allowing to flag the strings - to internationalize in the migration scripts. +* `_()` is equivalent to `unicode` allowing to flag the strings to + internationalize in the migration scripts. In the `repository` scripts, the following identifiers are also defined: -* `checkpoint`, request confirming and executing a "commit" at checking point +* `commit(ask_confirm=True)`, request confirming and executing a "commit" * `schema`, instance schema (readen from the database) diff -r cd033d2f4229 -r 40f53867e332 doc/book/en/index.rst --- a/doc/book/en/index.rst Tue Apr 13 19:21:20 2010 +0200 +++ b/doc/book/en/index.rst Tue Apr 13 19:22:46 2010 +0200 @@ -44,7 +44,7 @@ ================= .. toctree:: - :maxdepth: 2 + :maxdepth: 3 intro/index development/index @@ -58,4 +58,4 @@ * the :ref:`modindex`, * and the :ref:`search`. -.. |cubicweb| replace:: *CubicWeb* \ No newline at end of file +.. |cubicweb| replace:: *CubicWeb*