[Zope] How to exclude Confera messages?

Michel Pelletier michel@digicool.com
Tue, 24 Aug 1999 18:46:56 -0400


Loren Stafford wrote:
> 
> I built an example on a public site. Go to
> http://209.67.167.51/Quena/Discuss, then click on the "Announce..." message.
> 
> >
> > <!--#call "REQUEST.set('dirs', [])"-->
> > <!--#in expr="PARENTS" skip_unauthorized-->
> >   <!--#call "dirs.insert(0, id)"-->
> > <!--#/in-->
> >
> > <!--#in dirs-->
> > <!--#with "_[_['sequence-item']]"-->
> >
> >   <!--#if "_['sequence-start']"-->
> > <a href="/">Home</a>
> >   <!--#else-->
> >      <!--#if "_['sequence-end']"-->
> > &nbsp;&gt;&nbsp;<!--#var title_or_id-->
> >      <!--#else-->
> >  &gt;&nbsp;<a href="<!--#var absolute_url-->"><!--#var id--></a>
> >      <!--#/if-->
> >   <!--#/if-->
> >
> > <!--#/with-->
> > <!--#/in-->
> >
> > Sorry, an error occurred.
> > KeyError: Sorry, an error occured
> >

I don't know off hand what your problem is, but I believe your DTML can
be simplified by removing the building of the 'dirs' list, and extra
with tag, and several python expressions.  Here is a simplified,
'post-modern' Zope version of your DTML:

<dtml-in PARENTS skip_unauthorized>
  <dtml-if sequence-start>
    <a href="/">Home</a>
  <dtml-else>
    <dtml-if sequence-end>
      &nbsp;&gt;&nbsp;<dtml-var title_or_id>
    <dtml-else> 
      &gt;&nbsp;<a href="<dtml-var absolute_url>"><dtml-var id></a>
    </dtml-if>
  </dtml-if>
</dtml-in>

First, the inner layer with tag could be removed.  Saying:

<dtml-in sequence>
  <dtml-with sequence-item>
    <dtml-var whatever>
  </dtml-with>
</dtml-in>

is the same as:

<dtml-in sequence>
  <dtml-var whatever>
</dtml-in>

The 'sequence-item' namespace is the first namespace on the top of the
namespace stack while you are in an 'in' tag.  The <dtml-with> is
redundant.

If you want to whole list PARENTS, it is not necesary to put it in
quotes, because you are using it by name.  Notice I also took
'sequence-item', 'sequence-start' and 'sequence-end' out of their
"_['']" notation.  This is because you are also using them by name, like
PARENTS, so it is not necesary to quote them in an expression.  If you
had wanted to use 'sequence-item' in an expression, you would then need
to use the quotes, like: <dtml-var "_['sequence-item'] * 5">.  You can
use PARENTS in an expression when you want a specific item out of the
list, like <dtml-var "PARENTS[-1]"> (which is always the root folder, by
the way).

Since you had a keyerror it is likely that the 'dirs' list was causing
it.  It's removal might fix your bug.  Otherwise, I'd say the Confera
object is probably missing something that you want out of it.

-Michel