推荐学习书目
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
laomo
V2EX  ›  Python

[python新手]使用webpy写demo,数据库建表的时候按以前的习惯使用了_id,在python文件中可以,在模板中使用提示:access to attribute '_id' is denied

  •  
  •   laomo · Sep 7, 2013 · 3422 views
    This topic created in 4657 days ago, the information mentioned may be changed or developed.
    5 replies    1970-01-01 08:00:00 +08:00
    mengzhuo
        1
    mengzhuo  
       Sep 7, 2013 via Android
    不用就好了,啥ORM啊
    laomo
        2
    laomo  
    OP
       Sep 7, 2013
    @mengzhuo webpy直接连接mysql,想问下 python 使用数据库建表的时候有什么规范吗,像这个推荐使用“id”,不要使用“_id”?
    chuangbo
        3
    chuangbo  
       Sep 7, 2013 via iPhone
    webpy 为了安全禁止在模版里访问一切以下划线开头的变量和方法,因为下划线开头一般属于内部变量或内部方法,暴露不安全,算是一种约定吧
    yangzh
        4
    yangzh  
       Sep 7, 2013
    补充楼上,“下划线开头一般属于内部变量或内部方法” 是 python 的约定。
    laomo
        5
    laomo  
    OP
       Sep 7, 2013
    @chuangbo @yangzh 感谢2位,语言差异带来的问题,看来python使用数据库的话就是用类似id这种了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6033 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 156ms · UTC 03:20 · PVG 11:20 · LAX 20:20 · JFK 23:20
    ♥ Do have faith in what you're doing.