Zope ZPT Output only unique items from a list

You can leverage ZPT global variables to output unique items from a list.

The subset of python methods available to Zope is limited, so using global variables is a workable way to create a list of unique items.
<tal:unique_loop define="global items_unique python: []" repeat="item items">
	<span tal:condition="python: item not in items_unique">
		<tal:append define="dummy python: items_unique.append(item)" />
		<tal:output content="item" />
Posted by
Snippet Viewed 1671 times.

Share your Zope ZPT code snippets:

  • Get some recognition & a link back to your site.
  • Create your own code library.
  • Help your fellow developers, as they have helped you.


Submit | Browse

Most Recent zope zpt snippets

Most Viewed