[documentation] add note concerning Attribute, TODAY and NOW in yams documentation
authorErica Marco <erica.marco@logilab.fr>
Mon, 23 Mar 2015 11:08:04 +0100
changeset 10281 cc9eb88377f4
parent 10280 2cdab5e33542
child 10282 f96093ad32e4
[documentation] add note concerning Attribute, TODAY and NOW in yams documentation
doc/book/en/devrepo/datamodel/definition.rst
--- a/doc/book/en/devrepo/datamodel/definition.rst	Wed Mar 18 22:43:51 2015 +0100
+++ b/doc/book/en/devrepo/datamodel/definition.rst	Mon Mar 23 11:08:04 2015 +0100
@@ -244,8 +244,14 @@
 
 .. sourcecode:: python
 
-   from yams.constraints import BoundaryConstraint, TODAY
-   BoundaryConstraint('<=', TODAY())
+   from yams.constraints import BoundaryConstraint, TODAY, NOW, Attribute
+
+   class DatedEntity(EntityType):
+      start = Date(constraints=[BoundaryConstraint('>=', TODAY())])
+      end = Date(constraints=[BoundaryConstraint('>=', Attribute('start'))])
+
+   class Before(EntityType);
+      last_time = DateTime(constraints=[BoundaryConstraint('<=', NOW())])
 
 * `IntervalBoundConstraint`: allows to specify an interval with
   included values
@@ -259,7 +265,12 @@
 
 * `StaticVocabularyConstraint`: identical to "vocabulary=(...)"
 
-.. XXX Attribute, NOW
+Constraints can be dependent on a fixed value (90, Date(2015,3,23)) or a variable.
+In this second case, yams can handle :
+
+* `Attribute`: compare to the value of another attribute.
+* `TODAY`: compare to the current Date.
+* `NOW`: compare to the current Datetime.
 
 RQL Based Constraints
 ......................