[documentation] add note concerning Attribute, TODAY and NOW in yams documentation
--- 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
......................