[Zope-dev] Why is TemplateDict so opaque? -and- Have youseen this problem?

Dave Parker dparker@globalcrossing.com
Fri, 17 Dec 1999 11:21:58 -0600


Jim Fulton wrote:
> > - From an end-user perspective, I feel like I'm getting around a
> > *problem* with Zope's logic
> 
> In this case, the problem was with your understanding of Zope's
> logic.  This sort of thing will be an issue for most technologies.
> OTOH, the fact that you didn't understand what was going on was,
> at least partly, Zope's fault.
> 
> Although I think that the current situation is, on some level,
> justifiable, I'd also love to improve it.  While I understand
> why it is necessary to pass "_.None, _", I'd love for it to
> be unnecessary.
> 
> After reading your rant, I've given some thought to this and
> I think I might have an idea how to accomplish it. It does
> involve some, uh, hikinks, but should be doable.  I'll submit this
> as a feature request to the collector and champion it with the
> product management folks here.

(REQUEST seems to need to be in there as well to preserve acquisition as
well?)

That's great news!  

Bearing in mind that I've been ignorant of REQUEST,_,_.None 'til
yesterday, I'd guess that this change will answer about 80% of my issues
with Zope.

I don't know if I've mentioned it, but I really think Zope is among the
most brilliantly concieved notions to come down the pike in a long long
while.  (I'm a reluctant ranter ;)

> > So I can't pass in mapping objects??
> 
> Yes you can. Something else is going on. I just tried an
> example like yours and it worked fine for me.
> 
> I had method m1:
> 
>   <dtml-var value>
> 
> and called it from m2:
> 
>   <dtml-var standard_html_header>
> 
>   <dtml-var "m1(value={'this':'that'})">
> 
>   <dtml-var standard_html_footer>
> 
> and got:
> 
>   {'this': 'that'}

I think it had more to do with what I was trying to do with the value. 
I got a "Key Error", the meaning of which I probably misunderstood. 
Without attempting to pass the value in and attempting to do this:

<dtml-let values="{'this':'that'}">
<dtml-in values>
	<dtml-var sequence-key>
</dtml-in>
</dtml-let>

...I get this:

 Error type:  KeyError
 Error value: 0
Traceback (innermost last):
  File /home/caps/test/zope/lib/python/ZPublisher/Publish.py, line 165,
in publish
  File /home/caps/test/zope/lib/python/ZPublisher/mapply.py, line 160,
in mapply
    (Object: second)
  File /home/caps/test/zope/lib/python/ZPublisher/Publish.py, line 102,
in call_object
    (Object: second)
  File /home/caps/test/zope/lib/python/OFS/DTMLMethod.py, line 145, in
__call__
    (Object: second)
  File /home/caps/test/zope/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: second)
  File /home/caps/test/zope/lib/python/DocumentTemplate/DT_Let.py, line
145, in render
    (Object: values="{'this':'that'}")
  File /home/caps/test/zope/lib/python/DocumentTemplate/DT_In.py, line
672, in renderwob
    (Object: values)
KeyError: 0

So I was perhaps under the mistaken impression that I could iterate
through mapping structures...?

I strongly suspect this isn't a topic for the dev list anymore ;)