"""
$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/dulcinea/lib/comment.py $
$Id: comment.py 29510 2007-02-27 22:15:17Z dbinger $
"""
from dulcinea.base import DulcineaPersistent
from dulcinea.timestamped import Timestamped
from dulcinea.user import DulcineaUser
from qp.lib.spec import specify, add_getters, spec, string

class Comment(DulcineaPersistent, Timestamped):

    text_is = spec(
        string)
    user_is = spec(
        (None, DulcineaUser),
        "The author of the comment")

    def __init__ (self, text, user):
        Timestamped.__init__(self)
        specify(self, text=text, user=user)

    def __str__ (self):
        return "%s at %s" % (self.user, self.get_timestamp())


add_getters(Comment)
