Page Templates slots - Necessity is the mother of inventionSo I've been upgrading customers' Plone sites the last couple of months, and one thing I encountered is that there are changes in the main_template, where there is a new content-core slot.
It changes things a lot for existing templates, as content that uses the content-core slot were not getting a page header title (<h1>).
So, I browsed around in the zope.tal, zope.tales and zope.pagetemplate modules and in the process found defer: and lazy: - which were interesting and I gave those a go but didn't get it working properly.
I thought the standard template variable would be the right place to look, and it turned out to be right. Doing a pprint of the dictionary of the template variable gave a hit for fillSlots..
So, I packaged up some (very loosely tested) python code for getting the currently used slots here:
And it works well. With this installed you can run for example 'python:"content-core" in template.pt_filled_slots()' from within a template to see which slots the calling template is using.
Extremely useful to get around the content-core issue, and maybe it makes for some flexible, compact or clever constellations of macros in Zope's page templates.
[Permalink] [By morphex] [Python, Zope, Plone - and anything loosely related to that (Atom feed)] [2012 22 Mar 12:04 GMT+2]