[Zope] How to insert a DTML doc given its ID as a string?

Robert Rottermann robert@redcor.ch
Thu, 14 Mar 2002 07:44:22 +0100


I would do this in an script.
Lets call it "insertIf"

#test if thisWeeklyMain exists
doc = getattr(context, 'thisWeeklyMain', None)
if doc:
  # if yes return its content
  return doc.document_src()
else:
  # other document must exist
  return getattr(context, 'otherDoc').document_src()

now use this script like this
<dtml-var insertIf>

robert

----- Original Message -----
From: "Bill Bell" <bill-bell@bill-bell.hamilton.on.ca>
To: <zope@zope.org>
Sent: Thursday, March 14, 2002 2:27 AM
Subject: [Zope] How to insert a DTML doc given its ID as a string?



Must be trivial. Can't find answer.

'thisWeeklyMain' is a Python routine that supplies the name of a DTML doc
that _might_ exist in the current folder. I'd like to arrange to insert the
DTML doc, if it exists, or an alternative doc, if it does not.

Thanks for your help.

Bill

------------
"It is the time that you have wasted for your rose that makes your rose so
important."--St-Exupery



_______________________________________________
Zope maillist  -  Zope@zope.org
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 )