Ejemplo n.º 1
0
  def _Update(self):
    """Updates the database:
       1. Revives any followers that have removed the viewpoint.
       2. Creates the new comment.
    """
    # Revive any REMOVED followers.
    yield gen.Task(Follower.ReviveRemovedFollowers, self._client, self._followers)

    # Create the comment.
    yield Comment.CreateNew(self._client, **self._cm_dict)
Ejemplo n.º 2
0
  def _PostComment(self, sharer_user, timestamp, message, asset_id=None):
    """Creates a new comment and a corresponding activity."""
    comment_id = Comment.ConstructCommentId(timestamp, self._new_user.webapp_dev_id, self._unique_id)
    self._unique_id += 1
    comment = yield Comment.CreateNew(self._client,
                                      viewpoint_id=self._viewpoint_id,
                                      comment_id=comment_id,
                                      user_id=sharer_user.user_id,
                                      asset_id=asset_id,
                                      timestamp=timestamp,
                                      message=message)

    # Create post_comment activity.
    yield self._CreateActivity(sharer_user, timestamp, Activity.CreatePostComment, cm_dict={'comment_id': comment_id})

    raise gen.Return(comment)