[Zope3-Users] How to get the icon for a content item.

Tom Dossis td at yoma.com.au
Tue Nov 30 23:23:11 EST 2004


Tom Dossis wrote:
> 
> How can I get the icon for a content object, e.g. Folder?
> My ui is a gui, not a browser, but I'd like to use the zmi_icon (for now).

The following works, but is hackish..

 >>> root
<zope.app.folder.folder.Folder object at 0x4120c36c>

 >>> from zope.app import zapi
 >>> from zope.publisher.browser import TestRequest

 >>> icon = zapi.queryView(root, 'zmi_icon', TestRequest())
 >>> icon
<zope.app.publisher.browser.icon.IconView object at 0x4117ea2c>

 >>> icon()
u'<img 
src="http://127.0.0.1/@@/zope-app-folder-interfaces-IFolder-zmi_icon.gif" 
alt="Folder" width="16" height="16" border="0" />'


More information about the Zope3-users mailing list