Chapter 10.2.3. Fine Control on Behavior Using Metadata Class
Each model class has a nested class called sqlmeta that allows you to specify a plethora of interesting attributes such as caching and lazy updates, and a style object to control name translations. This is just a hint of what is to come. We discuss lazyUpdate thoroughly later on. Here is how to turn on lazy updates for the fighter robot:
class FighterRobot(SQLObject): class sqlmeta: lazyUpdate = True name = StringCol() weapon_1 = StringCol() weapon_2 = StringCol() engine = StringCol(default='Basic engine') health = IntCol(default=100)
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.