Esempio n. 1
0
    def delete(self):
        logging.warning("DELETE handler executing")
        path = self.request.path
        if path.startswith('/api/card/'):
            # delete an individual card
            response = api.card_update(self, delete=True)
        else:
            raise Exception("Unsupported API path: %s" % path)

        self.response.out.write(response)
Esempio n. 2
0
    def delete(self):
        logging.warning("DELETE handler executing")
        path = self.request.path
        if path.startswith('/api/card/'):
            # delete an individual card
            response = api.card_update(self, delete=True)
        else:
            raise Exception("Unsupported API path: %s" % path)

        self.response.out.write(response)
Esempio n. 3
0
    def put(self):
        path = self.request.path
        if re.match('/api/card/.+/import', path):
            # import a card to the current user's feed
            response = api.card_import(self)
        elif re.match('/api/card/.+/review', path):
            # record a review done on a card
            response = api.card_update(self, review=True)
        elif path.startswith('/api/card/'):
            # update an individual card
            response = api.card_update(self)
        elif re.match('/api/user/.+/follow', path):
            # follow a user
            response = api.user_follow_unfollow(self, 'follow')
        elif re.match('/api/user/.+/unfollow', path):
            # unfollow a user
            response = api.user_follow_unfollow(self, 'unfollow')
        elif path.startswith('/api/user/'):
            # update an individual user
            response = api.user_update(self)
        else:
            raise Exception("Unsupported API path: %s" % path)

        self.response.out.write(response)
Esempio n. 4
0
    def put(self):
        path = self.request.path
        if re.match('/api/card/.+/import', path):
            # import a card to the current user's feed
            response = api.card_import(self)
        elif re.match('/api/card/.+/review', path):
            # record a review done on a card
            response = api.card_update(self, review=True)
        elif path.startswith('/api/card/'):
            # update an individual card
            response = api.card_update(self)
        elif re.match('/api/user/.+/follow', path):
            # follow a user
            response = api.user_follow_unfollow(self, 'follow')
        elif re.match('/api/user/.+/unfollow', path):
            # unfollow a user
            response = api.user_follow_unfollow(self, 'unfollow')
        elif path.startswith('/api/user/'):
            # update an individual user
            response = api.user_update(self)
        else:
            raise Exception("Unsupported API path: %s" % path)

        self.response.out.write(response)