Exemplo n.º 1
0
    def delete(self, app_id=None):
        # pull the github token out of the social user db
        user_info = models.User.get_by_id(long(self.user_id))
        social_user = models.SocialUser.get_by_user_and_provider(
            user_info.key, 'github')

        # delete the app from the db
        app = models.App.get_by_id(long(app_id))

        # user owns this app?
        try:
            if long(app.owner.id()) == long(self.user_id):
                app.key.delete()
                github.delete_user_gist(social_user.access_token, app.gist_id)
                self.add_message(_('App successfully deleted!'), 'success')
                response = "App successfully deleted!"
            else:
                response = "Did you really think that would work without auth'ing?"
        except:
            response = "Did you really think that would work without auth'ing?"

        # notify browser through channel
        channel_token = self.request.get('channel_token')
        channel.send_message(channel_token, 'reload')

        params = {'app_response': response}
        return self.render_template('app/app_response.html', **params)
Exemplo n.º 2
0
    def delete(self, app_id = None):
        # pull the github token out of the social user db
        user_info = models.User.get_by_id(long(self.user_id))
        social_user = models.SocialUser.get_by_user_and_provider(user_info.key, 'github')

        # delete the app from the db
        app = models.App.get_by_id(long(app_id))

        # user owns this app?
        try:
            if long(app.owner.id()) == long(self.user_id):
                app.key.delete()
                github.delete_user_gist(social_user.access_token, app.gist_id)
                self.add_message(_('App successfully deleted!'), 'success')
                response = "App successfully deleted!"
            else:
                response = "Did you really think that would work without auth'ing?"
        except:
            response = "Did you really think that would work without auth'ing?"
            
        # notify browser through channel
        channel_token = self.request.get('channel_token')
        channel.send_message(channel_token, 'reload')

        params = {'app_response': response}
        return self.render_template('app/app_response.html', **params)
Exemplo n.º 3
0
    def delete(self, article_id = None):
        # pull the github token out of the social user db
        user_info = models.User.get_by_id(long(self.user_id))
        social_user = models.SocialUser.get_by_user_and_provider(user_info.key, 'github')

        # delete the entry from the db
        article = models.Article.get_by_id(long(article_id))

        if article:
            article.key.delete()
            github.delete_user_gist(social_user.access_token, article.gist_id)
            self.add_message(_('Article successfully deleted!'), 'success')
        else:
            self.add_message(_('Article was not deleted.  Something went horribly wrong somewhere!'), 'warning')

        # use the channel to tell the browser we are done and reload
        channel_token = self.request.get('channel_token')
        channel.send_message(channel_token, 'reload')
        return
Exemplo n.º 4
0
    def delete(self, username=None, article_id=None):
        # pull the github token out of the social user db
        user_info = models.User.get_by_id(long(self.user_id))
        social_user = models.SocialUser.get_by_user_and_provider(
            user_info.key, 'github')

        # delete the entry from the db
        article = models.Article.get_by_id(long(article_id))

        if article:
            article.key.delete()
            github.delete_user_gist(social_user.access_token, article.gist_id)
            self.add_message(_('Article successfully deleted!'), 'success')
        else:
            self.add_message(
                _('Article was not deleted.  Something went horribly wrong somewhere!'
                  ), 'warning')

        # use the channel to tell the browser we are done and reload
        channel_token = self.request.get('channel_token')
        channel.send_message(channel_token, 'reload')
        return