Section 4.4. Summary


4.4. Summary

  • You can define the columns and tables in your database easily in Python classes, and SQLObject will automatically generate them whenever you run tg-adin sql create.

  • You can use tg_admin shell to add new records to your database easily. You create new records in the database by instantiating new objects.

  • We used the Kid processing directive py:for for the first time to loop over all the bookmarks in the database. Kid's py:for and py:if functions work just like the standard Python constructs.

  • TurboGears provides a set of utility functions to help you write unit and functional tests. Unit tests for controller objects can be easily written using testutil.call(), which should first be passed a controller method (in our example cherrypy.root.list) that you want to call. Functional tests can use testutil.createRequest(), which takes the URL you want to test and runs through the full CherryPy stack, renders the output through your template, and makes it avalable in cherrypy.response.body[0].

  • When you post a form, it's easy to use those values in your controller methods because CherryPy passes them into the method as named parameters.




Rapid Web Applications with TurboGears(c) Using Python to Create Ajax-Powered Sites
Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites
ISBN: 0132433885
EAN: 2147483647
Year: 2006
Pages: 202

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net