예제 #1
0
파일: __init__.py 프로젝트: Ardroid/spm
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
예제 #2
0
파일: __init__.py 프로젝트: Ardroid/spm
def post_update(author, content):
  update = Content(title=content["title"], content=content["content"], author=author)
  update.save(bucket="spm_posts")
  return update
예제 #3
0
파일: __init__.py 프로젝트: Ardroid/spm
def del_comment(key, content):
  comment = Content.get(key, bucket="spm_comments")
  comment.delete()
예제 #4
0
파일: __init__.py 프로젝트: Ardroid/spm
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
예제 #5
0
파일: __init__.py 프로젝트: Ardroid/spm
def del_update(key):
  update = Content.get(key, bucket="spm_posts")
  for comment in update.comments:
    comment.delete()

  update.delete()
예제 #6
0
파일: __init__.py 프로젝트: Ardroid/spm
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
예제 #7
0
파일: projects.py 프로젝트: shuhaowu/spm
def get_wall_post(key):
  return Content.get(key, bucket="spm_wallposts")
예제 #8
0
파일: projects.py 프로젝트: shuhaowu/spm
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
예제 #9
0
파일: projects.py 프로젝트: shuhaowu/spm
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