def get(self, app_id): current_user = self.get_current_user_object() api_app = App.get('id = %s and user_id = %s', int(app_id), current_user.id) if not api_app: return self.redirect("/developers") return self.render("developers/edit-app.html", app=api_app)
def post(self, app_id=None): """ Handles AJAX post request to disconnect an app from a user. """ user = self.get_current_user_object() app = App.get("id = %s", app_id) if not app: return {'error': 'Invalid request.'} app.disconnect_for_user(user) return {'result': 'ok'}
def post(self, app_id): current_user = self.get_current_user_object() api_app = App.get('id = %s and user_id = %s', int(app_id), current_user.id) if not api_app: return self.redirect("/developers") api_app.title = self.get_argument('title', '').strip() api_app.description = self.get_argument('description', '').strip() api_app.redirect_url = self.get_argument('redirect_url', '').strip() if not api_app.save(): self.add_errors(api_app.errors) return self.render('developers/edit-app.html', app=api_app) return self.redirect("/developers/view-app/%s" % (api_app.id))