O'Reilly logo

Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites by Gigi Sayfan, Kevin Dangoor, Mark Ramm

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13.2.1. Transformations Using py:match

There are a number of advantages to the py:match approach, but perhaps the most important is that it takes only a single line of code per page to get headers, footers, sidebars, and other page elements inserted into your page.

You can use py:match to automatically add JavaScript or CSS references to all your pages, or even to add sidebars and other content to the body of all your pages. You can even use py:match to create custom tags like Java’s taglibs.

Given all that power, it can take a while to work your mind around how py:match works. Conceptually it’s simple: py:match searches through the rest of your template for matching elements and replaces them with the contents of the element to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required