V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
paloalto
V2EX  ›  Python

菜鸟真心求教,用web.py写用户注册时遇到数据存储问题了。

  •  
  •   paloalto · 2012-07-07 00:54:43 +08:00 · 2586 次点击
    这是一个创建于 4309 天前的主题,其中的信息可能已经有所发展或是发生改变。
    菜鸟一个,代码完全是照着教程上来的。

    class SignupHandler:
    def GET(self):
    f = register_form()
    return render.signup(f)

    def POST(self):
    f = register_form()
    name = web.input(name = "username")
    pwd = web.input(name = "password")
    if not f.validates():
    return render.signup(f)
    else:
    sequence_id = db.insert('userAuth', username = name, password = pwd, joindate = web.SQLLiteral("NOW()"), ipaddress = "111.1.1.1", lastactivity = web.SQLLiteral("NOW()"))
    raise web.seeother('/welcome')


    结果发现mysql里的数据变成了这样:



    谁能教教我怎么把用户输入的文本存到mysql里啊?

    ps:用户注册、登录时的cookie啊session啊什么的我先不管了,现在只要能正常存储数据就是迈了一大步,T^T。
    2 条回复    2015-06-03 01:30:05 +08:00
    paloalto
        1
    paloalto  
    OP
       2012-07-07 00:59:41 +08:00
    哈哈哈哈,我自己解决了!

    原来是这么写:
    name = web.input().username
    pwd = web.input().password
    mliml
        2
    mliml  
       2015-06-03 01:30:05 +08:00
    @paloalto
    hello,我现在也在写web.py 用户系统,只不过数据库用的是 sqlite3 ,想问下您还有没有当时写的代码可以参考下呢?本人是个菜鸟,写代码写得一头雾水。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1035 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 19:26 · PVG 03:26 · LAX 12:26 · JFK 15:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.