[Zope] Does Zope use dynamic scoping?
Paul Crowley
paul@hedonism.demon.co.uk
15 May 1999 03:03:20 +0100
I'm new to this, but I've got quite far and now I'm stuck - help!
This is with Zope-1.11.0pr1 under Linux.
As an exercise, I'm trying to write a Slashdot-esque threaded comment
system using PostgreSQL and ZPyGreSQL, and I wonder if my assumptions
about scoping are biting me.
Comments have an Object Identifier, "oid". I have an SQL method
"allcomments" that looks up all comments, and defines "oid" among
other variables (eg "subject"). "responses" looks up all the comments
that are responses to "oid".
allcomments looks like this:
select *, oid
from comments
and repliesto like this:
select *,oid
from comments
<!--#sqlgroup required where-->
<!--#sqltest oid column=reference type=int optional-->
<!--#/sqlgroup-->
This code works fine:
<!--#if repliesto-->
<ul>
<!--#in repliesto-->
<li><!--#var subject-->
<!--#/in-->
</ul>
<!--#/if-->
So why is it that this code works fine:
<ul>
<li>Before
<!--#in allcomments-->
<li><!--#var subject-->
<ul>
<li>Before: <!--#var subject-->
<!--#var oid-->
<!--#in allcomments-->
<li><!--#var subject-->
<!--#/in-->
<li>After: <!--#var subject-->
</ul>
<!--#/in-->
<li>After
</ul>
and does what you expect (in particular, the subject doesn't change
across the inner allcomments), but if I replace the inner
"allcomments" with "repliesto", I get this:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: Bad Request
Error Value: ['oid']
This is frustrating my attempts to use recursion to build threading
trees, it's late and I've written too many test scripts. Help much
appreciated!
--
__
\/ o\ paul@hedonism.demon.co.uk http://www.hedonism.demon.co.uk/paul/ \ /
/\__/ Paul Crowley Upgrade your legacy NT machines to Linux /~\