def post(self, section): token = md.get_default_access_token() if not token: self.redirect("/settings") return if section == "token": token_key = self.param("tk") token = md.get_access_token(token_key, users.get_current_user()) md.set_default_access_token(token) elif section == "media": show_avatar = self.param("show_avatar") show_media = self.param("show_media") settings = {} settings["m_show_avatar"] = True if show_avatar == "t" else False settings["m_show_media"] = True if show_media == "t" else False md.set_token_settings(token.key(), users.get_current_user(), **settings) elif section == "opti": opti = self.param("opti") settings = {} settings["m_optimizer"] = opti if opti != "none" or opti == "" else None md.set_token_settings(token.key(), users.get_current_user(), **settings) self.redirect("/m/s-")
def post(self): token_key = self.param('token_key') token = md.get_access_token(token_key, users.get_current_user()) md.set_default_access_token(token) self.redirect('/settings')