Example #1
0
    def up():
        account = Account(db, pops="id")
        # author = Author(request.params)
        # account = db.models["account"]
        res = account.model.find("*",
                                 clause="where name='{0}'".format(
                                     account.name))
        if len(res["data"]) > 0:
            info = "账号已经注册"
            return render("web/sign/register.html", info=info)
        else:
            account.rank = 100
            account.number = 1
            account.time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
            # account.insert(author.__dict__)
            # theme = Theme(db, request)
            # optRes = theme.findBy()["data"]
            # account.theme = json.dumps([optRes[0]["id"]] if len(optRes) > 0 else [])
            account.theme = "all"
            account.model.insert(dict(account))

            return redirect(url_for("sign.login"))