Quantcast
Channel: Planet Plone - Where Developers And Integrators Write
Viewing all articles
Browse latest Browse all 3535

Nidelven IT: Page Templates slots - Necessity is the mother of invention

$
0
0
So 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:

http://pypi.python.org/pypi/Products.PageTemplateFilledSlots...

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.

Viewing all articles
Browse latest Browse all 3535

Trending Articles