Example #1
0
 def add_post(self, thread, title, body, user):
     """
     Add a post
     """
     post = BBPost(title, body, user)
     thread.posts.append(post)
     DBSession.flush()
     return post
Example #2
0
 def delete_dependency(self, name, dep_id):
     """
     Delete a dependency
     """
     dep_id = int(dep_id)
     page = self.show(name)[0]
     item = self.show_dependency(page, dep_id)
     page.dependencies.remove(item)
     DBSession.flush()
     DBSession.delete(item)
Example #3
0
 def delete_dependency(self, name, dep_id):
     """
     Delete a dependency
     """
     dep_id = int(dep_id)
     page = self.show(name)[0]
     item = self.show_dependency(page, dep_id)
     page.dependencies.remove(item)
     DBSession.flush()
     DBSession.delete(item)
Example #4
0
 def add_forum(self, name, description, category):
     """
     Add a forum
     """
     try:
         self.get_forum_by_name(name)
         raise ForumFound
     except ForumNotFound:
         pass
     forum_obj = BBForum(name, description, category)
     DBSession.add(forum_obj)
     DBSession.flush()
     return forum_obj
Example #5
0
 def add_thread(self,
                title,
                description,
                body,
                user,
                forum=None,
                add_post=True):
     """
     Add a thread, optionally to a forum.
     """
     thread = BBThread(title, description)
     if forum:
         thread.forum = forum
     if add_post:
         self.add_post(thread, title, body, user)
     DBSession.add(thread)
     DBSession.flush()
     return thread
Example #6
0
 def render_comment(self, context, request, *args):
     comment = self.get_comment(*args)
     DBSession.flush()
     return render('board/view_thread_content.jinja2',
                   get_thread(context, request, comment.thread.id), request)