Exemple #1
0
def add_comment(key, author, content):
  comment = Content(title=content["title"], content=content["content"], author=author)
  update = Content.get(key, bucket="spm_posts")
  update.comments.append(comment)
  comment.save(bucket="spm_comments")
  update.save(bucket="spm_posts")
  return comment
Exemple #2
0
def post_update(author, content):
  update = Content(title=content["title"], content=content["content"], author=author)
  update.save(bucket="spm_posts")
  return update
Exemple #3
0
def del_comment(key, content):
  comment = Content.get(key, bucket="spm_comments")
  comment.delete()
Exemple #4
0
def edit_comment(key, content):
  comment = Content.get(key, bucket="spm_comments")
  comment.title = content["title"]
  comment.content = content["content"]
  comment.save(bucket="spm_comments")
  return comment
Exemple #5
0
def del_update(key):
  update = Content.get(key, bucket="spm_posts")
  for comment in update.comments:
    comment.delete()

  update.delete()
Exemple #6
0
def edit_update(key, content):
  update = Content.get(key, bucket="spm_posts")
  update.title = content["title"]
  update.content = content["content"]
  update.save(bucket="spm_posts")
  return update
Exemple #7
0
def get_wall_post(key):
  return Content.get(key, bucket="spm_wallposts")
Exemple #8
0
def get_all_posts_from_project(key):
  post_queries = Content.indexLookup("project_bin", key, bucket="spm_wallposts")
  posts = []
  for post in post_queries.run():
    posts.append(wall_post_to_display_json(post))
  return sorted(posts, key=lambda x: x["pubdate"])[:50] # TODO: pagination? lol? delete old items? wut
Exemple #9
0
def add_wall_post(key, content, user):
  post = Content(title=content, author=user)
  post.addIndex("project_bin", key)
  post.save(bucket="spm_wallposts")
  return post