Esempio n. 1
0
    def post(self):
        title = self.request.get('title')
        content = self.request.get('content')
        board = self.request.get('board')

        if title == '':
            self.error(400)
        else:
            author = getSecureUser(self.request)

            if(author is not None):
                # TODO: check if user is authorized to post in board

                newPost = Post(title=title, content=content, author=author, board=board)
                newPost.put()

                # TODO: redirect to post URL
            else:
                self.error(401)
Esempio n. 2
0
    def post(self):
        name = self.request.get('name')
        desc = self.request.get('desc')

        if name == '':
            self.error(400)
        else:
            creator = getSecureUser(self.request)

            if (creator is not None):
                existingBoard = Board.query(Board.name == name).fetch()

                if len(existingBoard) is 0:
                    admins = [creator]
                    newBoard = Board(name=name, desc=desc, admins=admins)
                    newBoard.put()
                else:
                    self.error(409)
            else:
                self.error(401)
Esempio n. 3
0
    def post(self):
        title = self.request.get('title')
        content = self.request.get('content')
        board = self.request.get('board')

        if title == '':
            self.error(400)
        else:
            author = getSecureUser(self.request)

            if (author is not None):
                # TODO: check if user is authorized to post in board

                newPost = Post(title=title,
                               content=content,
                               author=author,
                               board=board)
                newPost.put()

                # TODO: redirect to post URL
            else:
                self.error(401)