from sqlalchemy import Column, UnicodeText, Integer, String

from abilian.core.entities import Entity

# Local constants
MAX_COMMENT_LENGTH = 8000


class Comment(Entity):
  """A Comment on a Commentable object.
  """

  #: "pseudo" foreign key to the object of this comment.
  object_id = Column(Integer, nullable=False)

  #: the class of the object of this comment.
  object_class = Column(String, nullable=False)

  #: the comment's body, as HTML (?).
  content = Column(UnicodeText(MAX_COMMENT_LENGTH))

  @property
  def target(self):
    cls = None # get the class somehow
    return cls.query.get(self.target_id)

@@ -31,20 +31,16 @@
  Unicode
-Text
 , Intege
@@ -475,12 +475,8 @@
 code
-Text
 (MAX

fix definition for limited length text columns (on postgres Text() is only for unlimited length)