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

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Dec 1 06:43:44 EST 2004


On Tuesday 30 November 2004 23:23, 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" />'

What is hackish about that? It is exactely what I would have done. The icon is 
just a view named zmi_icon.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list