Chameleon PT Checkboxes
With pyramid, web developers have the choice to use various templating engines. Coming from Zope, "Chameleon ZPT Templates" are a good choice, as they are compatible to the ZPTs I've gotten used to over the years. The thing is, these templates are compatible, but there are differences.
One thing that had me wondering was how to set the "checked" attribute on checkbox input fields. In Zope's ZTPs, you can do something like tal:attributes="checked somevariable" and if somevariable is evaluated to True, then the checked-attribute will be set to "checked", otherwise it will not be there at all. It's a special case that is necessary for the way some browsers handle this attribute.
In Chameleon's PT, I got a lot of "None type is not callable" errors, or else it would show the box as checked when it shouldn't... and I was overall confused. Turns out the incantation that works for me here is something like this: tal:attributes="checked 'checked' if somevariable else None". It seems in order to not insert the "checked" attribute, Chameleon PT wants the value to be None, but it doesn't like python's True for a value either, therefore putting in the string 'checked'.