Nidelven IT - All about Python, Zope & Plone - and Open Source!

Here you'll find issues related to our services. Mostly about Python, Zope and Plone, as well as hosting-related issues.

"Keeping IT real"






Older entries



Atom - Subscribe - Categories
Previous | Next

Page Templates slots - Necessity is the mother of invention

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.

[Permalink] [By morphex] [Python, Zope, Plone - and anything loosely related to that (Atom feed)] [2012 22 Mar 12:04 GMT+2]

Add comment (text format)

Passphrase

A passphrase is required to comment on this weblog. It is required to make sure that bots aren't doing automatic spamming. It is: nit is the best!.

Title

Name

Email

Comment