Hi I want to use dtml. I tried these to check if content_html exists: 1: <dtml-if expr="_.has_key('content_html')"> Action! <dtml-else> Does not exist </dtml-if> 2: <dtml-in expr="objectValues()"> <dtml-var getId><br> <dtml-if expr="getId() == 'content_html'"> Action! </dtml-if> </dtml-in> I'm not sure of the syntax of expr in the first example. The second one works, but it seems a like overkill to me. And how do I now later that I found it? The dtml code below is not what I want, because it returns true when a parent object has "content_html". On Wed, 2002-07-31 at 15:05, Max M wrote:
Hans Sandsdalen wrote:
I'm new to zope, and I can't figure out how to check if an object (with a spesific name) exists in the current folder.
It kind of depends on where you want to check from. dtml, Python Script, Python product/external method or what have you.
dtml: <dtml-if someObj> <dtml-var showStuff> </dtml-if>
Python: if self.someFolder.has_key('someObj'): showStuff()
regards Max M
--
"Sorry I would Really Like To Help More On This Project, But Am To Busy Doing Paid Work On A Tight Deadline" Max M
-- / hans - http://go.to/tusenfrydveien32 / http://www.spacetec.no/~hans/dfood.htm /--------------------------------------------- / HANS = High Availability No Superman