[Zope] aborting DTML parsing

Chris McDonough chrism@digicool.com
Mon, 6 Dec 1999 02:27:04 -0500


I think dtml-return will do what you want it to.

For instance:

<dtml-unless is_a_person_i_want_to_see_this_page>
   <dtml-return dtMyPageTellingHimThatHeCantSeeThisObject>
</dtml-unless>

Will show dtMyPageTelling... and will not continue with the script.


Chris McDonough     mailto:chrism@digicool.com
Digital Creations   http://www.digicool.com
Publishers of Zope  http://www.zope.org

> -----Original Message-----
> From: Sam Gendler [mailto:sgendler@teknolojix.com]
> Sent: Sunday, December 05, 1999 10:20 PM
> To: chas
> Cc: Jan Stohner; Michel Pelletier; zope@zope.org
> Subject: Re: [Zope] aborting DTML parsing
> 
> 
> I hope I don't get flamed off this list, but here goes...  I 
> have recently had
> to delve into ColdFusion for a customer, and there are some 
> tags that would
> certiainly be useful.  <CFABORT> for example, stops execution 
> of a template.
> They have some nice constructs in the <CFLOOP> tag as well, 
> allowing loops
> equivalent to while, for, and <dtml-in> loops.  There is a
> <CFSWITCH><CFCASE></CFCASE></CFSWITCH> construct that I would 
> certainly find
> useful, too.  Don't worry, I have no intention of abandonning 
> zope in favour of
> CF, which is far superiour in SO many ways, but there is no 
> reason not to use
> their good ideas...
> 
> Didn't I see some reference to a <dtml-return> tag in version 
> 2.1.  I haven't
> checked the docs for new tags, but I thought I saw some email 
> that mentioned
> such a tag.  I might mention that there was no mention 
> whatsoever of new dtml
> tags in the CHANGES.TXT file.
> 
> --sam
> 
> chas wrote:
> 
> >
> > >> Just raise an error way down deep, and catch it at the 
> higher method
> > >> with <dtml-try> and <dtml-except>.  I think these tags 
> were added in
> > >> 2.0.0
> > >
> > >This is a solution, but i have to modify all my DTML documents. All
> > >documents are beginning with "<dtml-var 
> standard_html_header>" and i COULD
> > >change all documents to "<dtml-try><dtml-var
> > >standard_html_header>....<dtml-except>...", but this is 
> not my preferred
> > >solution.
> >
> > This is a problem I've also encountered and, as you mention,
> > the try/except requires modifying all pages. I'd also like to
> > find a better solution.
> >
> > Is there no equivalent of Python's sys.exit(0) ?
> >
> > chas
> >
> > _______________________________________________
> > 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 )
> 
> 
> _______________________________________________
> 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 )
>