[Zope3-dev] Testing for a view

Casey Duncan casey@zope.com
Tue, 4 Mar 2003 17:04:35 -0500


On Tuesday 04 March 2003 04:16 pm, Sidnei da Silva wrote:
> On Tue, Mar 04, 2003 at 04:06:08PM -0500, Casey Duncan wrote:
> | On Tuesday 04 March 2003 03:24 pm, Sidnei da Silva wrote:
> | > Howdy,
> | >=20
> | > I just stumbled on a small thing that I think that could be easily
> | > fixed, but I dont know if everyone would agree on this. Heres the
> | > issue:
> | >=20
> | > Currently, the metadata box on is rendered using a view for
> | > dublincore. This view can be accessed using @@MetaDataBox.=20
> | >=20
> | > When testing for inclusion of the metadata box, the Z3 UI right now
> | > tests does this:
> | >=20
> | > ....=20
> | >      tal:define=3D"view context/@@MetaDataBox"
> | >      tal:condition=3D"view">
> | > ....
> | >=20
> | > But theres a small problem in here. The metadata box is a page
> | > template with a few conditions and if all those conditions evaluate=
 to
> | > false, this view will not return an empty string, but a string that
> | > contains only spaces. From the Browser POV, a string that only
> | > contains spaces is not very useful so, I propose:
> |=20
> | Couldn't you just use:
> |=20
> | tal:condition=3D"view/strip"
> |=20
> | To make a string that is all spaces evaluate false?
>=20
> I think so, unless 'view' isnt a string. But Im almost sure it will be
> most of the time.

In that case:

tal:condition=3D"view/strip|nothing"

unless of course view is a dict with the key 'strip' ;^)

-Casey