[Zope] ZPT : prevent unauthorized error

Evan Simpson evan@4-am.com
Fri, 03 Aug 2001 10:46:12 -0400


kent sin wrote:

> Error Type: Undefined
> Error Value: "You are not authorized to access icon."
> not found in "item1/icon"
> 
> How could I prevent this happen? Or to provide an
> default icon instead?

Whenever you use a path that may fail, you can provide a fallback path 
using the "|" operator.  The most common fallback paths are "default" 
and "nothing", but you can use any path.  For example:

Default (leave src value alone):
<img src="/images/default_icon" tal:attributes="item1/icon | default">

Dynamic fallback:
<img src="icon" tal:attributes="item1/icon | here/default_icon">

Cheers,

Evan @ 4-am & Zope