Ejemplo n.º 1
0
    def addComment(self, schoolID, commentData):

        user = User.get_by_id(int(commentData["userID"]))

        comment = Comments(school_id=schoolID, text=commentData["text"], user=user)

        comment.put()

        # create a new up/downvote key in memcache
        key = "CommentUpvote.%i" % comment.key().id()
        memcache.add(key, 0)
        key = "CommentDownvote.%i" % comment.key().id()
        memcache.add(key, 0)

        return comment