Exemplo n.º 1
0
    def post(self, *args, **kwargs):
        result = {}
        id = self.get_argument('id')
        pwd = self.get_argument('pwd')
        email = self.get_argument('email')
        desc = self.get_argument('description')

        try:
            id = qn(id)
            pwd = qn(pwd)
            email = qn(email)
            desc = qndes(desc)
            if desc != '':
                desc = text2Html(desc)
            if not getUserById(id):
                try:
                    signUp(id, pwd, email, desc)
                    result['result'] = 'success'
                except IntegrityError:
                    result['result'] = 'email_existed'
            else:
                result['result'] = 'user_existed'
        except TypeError:
            result['result'] = 'special_marks'

        self.write(json_encode(result))
Exemplo n.º 2
0
    def post(self, *args, **kwargs):
        email = self.get_argument('email')
        description = self.get_argument('description')
        if not getUserById(self.id):
            self.redirect('/error/no_such_user')
        else:
            try:
                description = qndes(description)
                description = text2Html(description)  # 保存换行信息
                email = qn(email)

                userSetPortrait(email, description, self.id)
                self.redirect('/user')
            except TypeError:
                self.redirect('/error/special_marks/share')