[Zope] Re: Direct SQL-Method traversal
Stefan Bund
asbund@gmx.de
16 Jun 1999 11:30:48 +0200
Stefan Bund <asbund@gmx.de> writes:
> I have implemented a simple ZSQL-Method (fetch) which takes one argument, a
> record number (nr). As far as I understand the ZSQL Manual, I should
> be able to write URL's of the form
>
> fetch/nr/<number>/showit
>
> where showit is a DTML-Document which can access the result of the
> fetch query. How do I access this result? I tried to use the column
> names (like <!--#var shortname-->, where shortname is a result column
> name), but Zope gave me a Key Error. What is the correct syntax to
> access the result columns of such a query?
I followup to my own posting, since I've found out something more: If
I wrap the reference to 'shortname' into a <!--#with "PARENTS[1]"-->
it works. Now this makes me ask a question about acquisition in Zope:
I thought, Zope would search the object and all it's PARENT's to fetch
objects. In the case of the above URL, the PARENTS seam to be somthing
like [ <Zope-folder>,<Traverse-Wrapper>,<Result-record>,<Zope-folder ]
(I realy don't know exactly, that's what I believe to be possible
after inspecting the source). OTOH the Parent relationship (aq_parent)
seams to be 'Zope-Folder->showit'. So am I right, that Zope only
searches the aq_parent tree? No, I don't think so (at least when I see
the recursive Acquisition thread, acquisition seams to work by PARENTS
too) but this does look like it.
Any comment from the Zope-Hackers? I'd really like to understand,
what's going on here, especially since I'm just beginning with Zope.
Thanks in advance for all your nice comments :-)
Stefan.