def post(self, id): zsite = Zsite.mc_get(id) user_info = UserInfo.get(id) name = self.get_argument('name', None) motto = self.get_argument('motto', None) txt = self.get_argument('txt', '') sex = self.get_argument('sex', 0) if name: zsite.name = name zsite.save() if motto: _motto.set(id, motto) if txt: txt_new(id, txt) if sex: user_info.sex = sex user_info.save() search_new(id) self.redirect('/zsite/%s' % id)
def save_user_info(self): current_user_id = self.current_user_id name = self.get_argument('name', None) if name and not name.isdigit(): zsite_name_edit(current_user_id, name) motto = self.get_argument('motto', None) if motto: _motto.set(current_user_id, motto) txt = self.get_argument('txt', '') if txt: txt_new(current_user_id, txt) birthday = self.get_argument('birthday', '0') birthday = int(birthday) marry = self.get_argument('marry', '') pid_home = self.get_argument('pid_home', '1') pid_now = self.get_argument('pid_now', '1') try: pid_now = int(pid_now) except ValueError: pid_now = 0 try: pid_home = int(pid_home) except ValueError: pid_home = 0 marry = int(marry) if marry not in (1, 2, 3): marry = 0 o = user_info_new(current_user_id, birthday, marry, pid_home) if pid_now: c = namecard_get(current_user_id) if c: c.pid_now = pid_now c.save() else: c = namecard_new(current_user_id, pid_now=pid_now) if not o.sex: sex = self.get_argument('sex', 0) if sex and not o.sex: sex = int(sex) if sex not in (1, 2): sex = 0 if sex: if o: o.sex = sex o.save() else: user_info_new(current_user_id, sex=sex) search_new(current_user_id)
def save_user_info(self): current_user_id = self.current_user_id name = self.get_argument('name', None) if name: zsite_name_edit(current_user_id, name) motto = self.get_argument('motto', None) if motto: _motto.set(current_user_id, motto) txt = self.get_argument('txt', '') if txt: txt_new(current_user_id, txt) birthday = self.get_argument('birthday', '0') birthday = int(birthday) marry = self.get_argument('marry', '') pid_home = self.get_argument('pid_home', '1') pid_now = self.get_argument('pid_now', '1') try: pid_now = int(pid_now) except ValueError: pid_now = 0 try: pid_home = int(pid_home) except ValueError: pid_home = 0 marry = int(marry) if marry not in (1, 2, 3): marry = 0 o = user_info_new(current_user_id, birthday, marry, pid_home) if pid_now: c = namecard_get(current_user_id) if c: c.pid_now = pid_now c.save() else: c = namecard_new(current_user_id, pid_now=pid_now) if not o.sex: sex = self.get_argument('sex', 0) if sex and not o.sex: sex = int(sex) if sex not in (1, 2): sex = 0 if sex: if o: o.sex = sex o.save() else: user_info_new(current_user_id, sex=sex) search_new(current_user_id)
def save_user_info(self): current_user_id = self.current_user_id name = self.get_argument("name", None) if name and not name.isdigit(): zsite_name_edit(current_user_id, name) motto = self.get_argument("motto", None) if motto: _motto.set(current_user_id, motto) txt = self.get_argument("txt", "") if txt: txt_new(current_user_id, txt) birthday = self.get_argument("birthday", "0") birthday = int(birthday) marry = self.get_argument("marry", "") pid_home = self.get_argument("pid_home", "1") pid_now = self.get_argument("pid_now", "1") try: pid_now = int(pid_now) except ValueError: pid_now = 0 try: pid_home = int(pid_home) except ValueError: pid_home = 0 marry = int(marry) if marry not in (1, 2, 3): marry = 0 o = user_info_new(current_user_id, birthday, marry, pid_home) if pid_now: c = namecard_get(current_user_id) if c: c.pid_now = pid_now c.save() else: c = namecard_new(current_user_id, pid_now=pid_now) if not o.sex: sex = self.get_argument("sex", 0) if sex and not o.sex: sex = int(sex) if sex not in (1, 2): sex = 0 if sex: if o: o.sex = sex o.save() else: user_info_new(current_user_id, sex=sex) search_new(current_user_id)