Pylons Tips

Thu 02 July 2009
  • 手艺 tags:
  • pylons
  • python
  • web published: true comments: true

All scripts created by paster(paster create, paster controller and etc.) uses 4 spaces as indent while many editors(vim) uses tabs automatically. Different indent in one file will cause fatal error.

h.url_for is a popular helper function in many books and tutorials which to solve url mapping. This tool is no longer available by default since 0.97. If you got error message like "AttributeError: 'module' object has no attribute 'url_for'", just add

[codesyntax lang="python"]from routes import url_for[/codesyntax]
to yourapp/libs/helper.py .