Skip to main content

PyCon: Tutorial: Mastering Pylons and TurboGears 2: Moving Beyond the Basics

Tutorial: Mastering Pylons and TurboGears 2: Moving Beyond the Basics

The tutorial was centered on creating a wiki in TurboGears 2. As you may know, TurboGears 2 is based on Pylons.

When in a template, TG2 doesn't have anything like Pylons' url_for function.

In TG2 you receive the form parameters as method arguments. This is arguably more tightly coupled with the form. If you expect to receive some random arguments, make sure you use **kargs.

I asked about the code snippet "redirect('/' + pagename)". The speaker didn't know if this was a temporary redirect or a see other redirect. Make sure you don't pass a full URL to the redirect function.

The whole talk was sort of strange. They would say, "Here's how you do it in TG2, and here's how you do it in Pylons." TG2 still has a fairly different API than Pylons. The idea is to sell Pylons as the stable, low-level API and to provide tons of extras on top of it in TG2. The extras might include an authentication framework, an admin interface, etc.

The new Pylons project creation template now asks questions during project creation such as whether to use SQLAlchemy and what templating engine to use.

The version of Pylons they were using was created just that morning. This resulted in a few crashes. Eventually, they passed around the egg on a USB key.

The tutorial wasn't quite as smooth as Titus's testing tutorial. I think trying to get people to actually follow along with a sample exercise by typing code on their computers is a tough thing to do.

Paste's exception handling still amazes the newbies.

Functions such as "pylons.templating.render_mako" are replacing Buffet, the previous templating engine abstraction layer.

Pylons is beginning to feel very polished.

TG1 had an entire infrastructure for forms that they're hoping to port to TG2. It could even introspect the database to create the form.

CherryPy is still considered very nice and very fast.

Comments