# HG changeset patch # User Erica Marco # Date 1427105284 -3600 # Node ID cc9eb88377f4e95cc65281531bf5902afeacdcd5 # Parent 2cdab5e33542b4eb0ef341104556c943dcaa0b2f [documentation] add note concerning Attribute, TODAY and NOW in yams documentation diff -r 2cdab5e33542 -r cc9eb88377f4 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 ......................