コード例 #1
0
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)
コード例 #2
0
ファイル: i.py プロジェクト: immissile/42qu_github_mirror
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)
コード例 #3
0
ファイル: i.py プロジェクト: immissile/42qu_github_mirror
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)
コード例 #4
0
    def post(self):

        current_user = self.current_user
        current_user_id = current_user.id
        result = {}
        error = {}


        name = self.get_argument('name', None)
        if not name:
            error['name'] = '请输入姓名'

        sex = None
        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            sex = self.get_argument('sex', '0')
            if not(sex and int(sex) in (1, 2)):
                error['sex'] = '请选择性别'

        password = None
        if not UserPassword.get(current_user_id):
            password = self.get_argument('password', None)
            if not password:
                error['password'] = '******'

        if not error:
            if password:
                user_password_new(current_user_id, password)

            if sex:
                user_info_new(current_user_id, sex=sex)

            current_user.name = name
            current_user.save()
        else:
            result['error'] = error

        self.finish(result)
コード例 #5
0
ファイル: newbie.py プロジェクト: xqk/42qu_github_mirror
    def post(self):
        name = self.get_argument('name', None)
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id

        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            if not (sex and int(sex) in (1, 2)):
                errtip.sex = '请选择性别'

        password = UserPassword.get(current_user_id)
        if not password:
            password = self.get_argument('password', None)
            if not password:
                errtip.password = '******'
            else:
                user_password_new(current_user_id, password)

        if name:
            current_user.name = name
            current_user.save()

        if not errtip:
            path = '/i/guide'
            user_info_new(current_user.id, sex=sex)
            return self.redirect(path)

        id_list = SHOW_LIST
        zsite_list = filter(bool, Zsite.mc_get_list(id_list))
        return self.render(
            sex=sex,
            name=name,
            errtip=errtip,
            zsite_list=zsite_list,
        )
コード例 #6
0
    def post(self):
        name = self.get_argument('name', None)
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id

        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            if not(sex and int(sex) in (1, 2)):
                errtip.sex = '请选择性别'

        password = UserPassword.get(current_user_id)
        if not password:
            password = self.get_argument('password', None)
            if not password:
                errtip.password = '******'
            else:
                user_password_new(current_user_id, password)

        if name:
            current_user.name = name
            current_user.save()

        if not errtip:
            path = '/i/guide'
            user_info_new(current_user.id, sex=sex)
            return self.redirect(path)

        id_list = SHOW_LIST
        zsite_list = filter(bool, Zsite.mc_get_list(id_list))
        return self.render(
                   sex=sex,
                   name=name,
                   errtip=errtip,
                   zsite_list=zsite_list,
               )