Chapter 3.3. Understanding SQLObject and TurboGears Models

At the core of an MVC style application is your domain model, which in TurboGears is usually connected to a relational database through SQLObject. As mentioned in Chapter 1, “Introduction to TurboGears,” SQLObject makes database rows into objects and the data they contain into attributes.

This means you can write simple commands like these:

> User(first_name="Jane", last_name="Goodall")
> users_named_jane = UserTable.selectBy(first_name="Jane")
Figure 3.2. SQLObjects are automatically stored in table rows.

For now, we’ll assume that the User class is already created. So, the first ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.