Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites

Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites
Language: EnglishFormat: CHM
Author: Mark Ramm, Kevin Dangoor, Gigi Sayfan File size: 6.2 MB
Publisher: Prentice Hall PTRPublish date: November 2006
Tags: IT Books in Amazon

Rapid Web Applications with TurboGears is designed to help you learn to develop web applications faster by using the full set of features included in TurboGears.

To that end, we've divided this book up into several parts: First we'll get an overview of TurboGears and how everything fits together. Then we'll dive right in and create a simple application, and get an overview of how TurboGears works. Then we'll jump into a real world project management application that takes advantage of many of TurboGears's more advanced features. These first three sections are designed to introduce the commonly used features of all the main TurboGears components, to provide you with some insight into the TurboGears philosophy, and to help you build web applications faster. When you're done with the first three sections, you ought to be able to use TurboGears to write reasonably complex applications.

When you're ready to take it up a notch, we also have several more sections that go in depth on each of the various technologies that TurboGears uses to make your life easier.

We'll delve more deeply into MochiKit, SQLObject, Kid, and CherryPy. We'll also explore the TurboGears specific pieces, widgets, and decorators in much greater depth. We'll talk about scaling and performance. We'll show you more advanced patterns, and generally help you take your TurboGears programming ability to the next level.

Along the way you may want to download example code, ask questions, or get more information about a particular subject. We've created www.turbogearsbook.com so that there is a living and changing repository for all kinds of extra stuff that we couldn't fit in the book, or which is simply too new to have been included here.

This book assumes you have a basic understanding of web technologies like XHTML, CSS, and Javascript along with an understanding of Python, and the basics of Relational Databases. We've tried not to assume too much, and we intentionally picked reviewers who were new to one or more of these areas in an attempt to make the learning curve as smooth as possible. But if you are new to any of these technologies, we've got some articles, links, and book recommendations on our website.

The goal for TurboGears, and for this book, is to make easy things easy, and hard things possible. After the first couple sections you should feel comfortable making basic database driven sites, and after the next few sections you'll have the tools you need to create complex Ajax enabled sites with dynamic user interfaces.

Table of contents
  • Part I: TurboGears Fundamentals
    • Chapter 1. Introduction to TurboGears
      • Section 1.1. Why TurboGears?
      • Section 1.2. The History of TurboGears
      • Section 1.3. TurboGears, Ajax, and Web 2.0
      • Section 1.4. Why TurboGears Values Being "Pythonic"
      • Section 1.5. What Can You Do with TurboGears?
      • Section 1.6. Coming Soon to a TurboGears Near You
      • Section 1.7. Summary
    • Chapter 2. Getting Started with TurboGears
      • Section 2.1. Installing TurboGears and SQLite
      • Section 2.2. Creating a Hello World Application
      • Section 2.3. Say Hi! (Simple Template)
      • Section 2.4. Custom Greetings (Hello from the Controller)
      • Section 2.5. Summary
    • Chapter 3. The Architecture of a TurboGears Application
      • Section 3.1. What Is MVC?
      • Section 3.2. Design Patterns and Object-Oriented MVC
      • Section 3.3. Understanding SQLObject and TurboGears Models
      • Section 3.4. Understanding CherryPy and TurboGears Controllers
      • Section 3.5. Understanding Kid and TurboGears Views
      • Section 3.6. MVC Meets Ajax
      • Section 3.7. Summary
  • Part II: Building a Simple TurboGears Application
    • Chapter 4. Creating a Simple Application
      • Section 4.1. Building a Simple Bookmark Collection Site
      • Section 4.2. Testing TurboGears Applications
      • Section 4.3. A Simple Form to Add Bookmark
      • Section 4.4. Summary
    • Chapter 5. Enhancing Our Bookmark Application
      • Section 5.1. Updating Our Model
      • Section 5.2. Listing by Category
      • Section 5.3. Updating Our Form
      • Section 5.4. Tying Everything Together
      • Section 5.5. Selecting Categories
      • Section 5.6. Summary
  • Part III: Exploring a Real World TurboGears Application
    • Chapter 6. Exploring More Complex Models in WhatWhat Status
      • Section 6.1. What Is WhatWhat Status?
      • Section 6.2. Logging in and Using WhatWhat Status
      • Section 6.3. Exploring the WhatWhat Status Model
      • Section 6.4. Writing Better Model Classes
      • Section 6.5. Summary
    • Chapter 7. Controllers, Views, and JavaScript in the WhatWhat Status
      • Section 7.1. Dashboard Controller
      • Section 7.2. Dashboard Templates
      • Section 7.3. Adding a New Project
      • Section 7.4. Dashboard Controller new_project
      • Section 7.5. Summary
    • Chapter 8. RSS, Cookies, and Dynamic Views in WhatWhat Status
      • Section 8.1. Cookies and RecentChanges
      • Section 8.2. The Recent Changes Template
      • Section 8.3. WhatWhat Status Widgets
      • Section 8.4. Easy RSS with FeedController
      • Section 8.5. Summary
    • Chapter 9. Ajax and WhatWhat Status Projects
      • Section 9.1. Handling Ajax Requests
      • Section 9.2. Digging Into the Project Controller Methods
      • Section 9.3. A First Look at project.kid
      • Section 9.4. Summary
  • Part IV: SQLObject and TurboGears Models
    • Chapter 10. SQLObject Basics
      • Section 10.1. ORM Basics
      • Section 10.2. Basic SQLObject Features
      • Section 10.3. Simple Database Queries
      • Section 10.4. Summary
    • Chapter 11. Mastering SQLObject
      • Section 11.1. Mapping Relationships
      • Section 11.2. Straight SQL Queries
      • Section 11.3. Smart Queries
      • Section 11.4. Working with Large Result Sets
      • Section 11.5. Summary
    • Chapter 12. Customizing SQLObject Behavior
      • Section 12.1. Customizing SQLObject Classes with sqlmeta
      • Section 12.2. More-Advanced SQLObject Customization
      • Section 12.3. SQLObject and Inheritance
      • Section 12.4. SQLObject and Transactions
      • Section 12.5. Summary
  • Part V: TurboGears View Technologies
    • Chapter 13. Dynamic Templates with Kid
      • Section 13.1. Creating Dynamic Templates with Kid
      • Section 13.2. Beyond the Basics: Keeping Your Templates DRY (Don't Repeat Yourself)
      • Section 13.3. Bringing It All Together
      • Section 13.4. Summary
    • Chapter 14. Creating Better JavaScript with MochiKit
      • Section 14.1. How to Use This Chapter
      • Section 14.2. Introduction to MochiKit and Its Interactive Shell
      • Section 14.3. Base Functions
      • Section 14.4. Iterators in JavaScript
      • Section 14.5. The Document Object Model
      • Section 14.6. Using MochiKit.Logging to Debug
      • Section 14.7. Working with Color
      • Section 14.8. String Conversions and Value Formatting
      • Section 14.9. Summary
    • Chapter 15. Effective Ajax with MochiKit
      • Section 15.1. Handling Asynchronous EventsIncluding Ajax Requests
      • Section 15.2. Handling JavaScript Events with MochiKit.Signal
      • Section 15.3. Visual Effects for That "Wow Factor"
      • Section 15.4. Summary
    • Chapter 16. TurboGears Widgets: Bringing CSS, XHTML, and JavaScript Together in Reusable Components
      • Section 16.1. Understanding Widgets
      • Section 16.2. Form Widgets
      • Section 16.3. Compound Widgets
      • Section 16.4. Widgets and Validation
      • Section 16.5. CSS, JavaScript, and Widgets
      • Section 16.6. Creating Custom Widgets
      • Section 16.7. Anatomy of an Ajax Widget
      • Section 16.8. Summary
  • Part VI: CherryPy and TurboGears Controller Technologies
    • Chapter 17. CherryPy and TurboGears Decorators
      • Section 17.1. CherryPy URL Parsing
      • Section 17.2. CherryPy and the HTTP Request/Response Cycle
      • Section 17.3. CherryPy Filters
      • Section 17.4. CherryPy and TurboGears Configuration
      • Section 17.5. Decorators
      • Section 17.6. Error and Exception Handling
      • Section 17.7. RESTful Resources in TurboGears
      • Section 17.8. Summary
    • Chapter 18. TurboGears Deployment
      • Section 18.1. Choosing Your Production Environment
      • Section 18.2. Using mod_rewrite or mod_proxy to Connect to CherryPy
      • Section 18.3. Running CherryPy on mod_python
      • Section 18.4. Other Ways of Running CherryPy behind a Web Server
      • Section 18.5. Scalability of Your Site
      • Section 18.6. Summary
  • Part VII: TurboGears Extras
    • Chapter 19. The TurboGears Toolbox and Other Tools
      • Section 19.1. Toolbox Overview
      • Section 19.2. ModelDesigner
      • Section 19.3. CatWalk
      • Section 19.4. WebConsole
      • Section 19.5. Widget Browser
      • Section 19.6. Admi18n and System Info
      • Section 19.7. The tg-admin Command
      • Section 19.8. Other TurboGears Tools
      • Section 19.9. Summary
    • Chapter 20. Internationalization
      • Section 20.1. Dealing with Unicode in Python
      • Section 20.2. Dealing with Unicode in TurboGears
      • Section 20.3. Translating Your Application
      • Section 20.4. Summary
    • Chapter 21. Testing a TurboGears Application
      • Section 21.1. Nose
      • Section 21.2. TurboGears testutil
      • Section 21.3. Mechanize
      • Section 21.4. Selenium
      • Section 21.5. Summary
    • Chapter 22. TurboGears Identity and Security
      • Section 22.1. Basic Authentication/Authorization with Identity
      • Section 22.2. Validating User Access with Identity
      • Section 22.3. Avoiding Common Security Pitfalls
      • Section 22.4. Summary
  • Part VIII: Appendix
    • Appendix A. SQLAlchemy
      • Section A.1. A Quick Tour of SQLAlchemy
      • Section A.2. SQLAlchemy in TurboGears
      • Section A.3. Data Mapper and Active Record
      • Section A.4. More about ActiveMapper
      • Section A.5. How Objects Are Cached in SQLAlchemy
      • Section A.6. Should I Use SQLAlchemy or SQLObject?
      • Section A.7. Migrating a Project to SQLAlchemy
      • Section A.8. Deployment Configuration
      • Section A.9. Application Configuration
      • Section A.10. Class Definitions
      • Section A.11. Changing Calls to byName Methods
      • Section A.12. Updating Queries
      • Section A.13. Final Thoughts