[Zope3-dev] Testing for a view

Sidnei da Silva sidnei@x3ng.com
Tue, 4 Mar 2003 17:24:55 -0300


Howdy,

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:

Currently, the metadata box on is rendered using a view for
dublincore. This view can be accessed using @@MetaDataBox. 

When testing for inclusion of the metadata box, the Z3 UI right now
tests does this:

.... 
     tal:define="view context/@@MetaDataBox"
     tal:condition="view">
....

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:

- Modify browser views so that when they render to a string that contains only
spaces its value evaluates to false.

and optionally:

- Modify browser views so that when they render to a string that its a
html comment ( a string enclosed into <!-- and --> ) it evaluates to false.

I can think of lots of problems that this may cause, but i think this
change makes the use of views more intuitive and reduces the amount of
coding when reusing a view. 

[]'s
-- 
Sidnei da Silva (dreamcatcher) <sidnei@x3ng.com.br>
X3ng Web Technology <http://www.x3ng.com.br>
GNU/Linux user 257852
Debian GNU/Linux 3.0 (Sid) 2.4.18 ppc

New systems generate new problems.