T.J. Mannos wrote: > > I have a DTML document called "apples". > > A call to <dtml-var document_id> gives the string "apples" > > However, a <dtml-if "document_id == 'apples'"> returns false. Am I missing > something? I've tried _.str(document_id) and even > _.string.strip(_.str(document_id)). The tag <dtml-var document_id> gets a value for document_id, and looks to see if it is callable. If so, it calls it and returns the result of calling it. If not, it just returns it. This is a feature of <dtml-var name="whatever">, which is another way of writing <dtml-var whatever>. However, when you use an expression, such as you are doing in the dtml-if tag, you are writing in Python, and you need to call an object if it ought to be called. An expression is something like <dtml-var "expression"> or <dtml-var expr="expression>, which are equivalent. The same goes for <dtml-if "expression">. In your case, you might find that this works: <dtml-if "document_id() == 'apples'"> Or perhaps this: <dtml-if "document_id(_.None, _) == 'apples'"> The reason is that ids ought always to be simple string objects, but some aren't. There are lots of legacy programs that rely on some ids being methods, so the odd cases won't be changed for a while yet. The general answer is to use a special function that calls the value if it is callable. You have a choice here. These are equivalent. <dtml-if "_['document_id'] == 'apples'"> <dtml-if "_.getitem('document_id', 1) == 'apples'"> -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net _______________________________________________ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )