[Zope] calling methods in differing folders
Chris McDonough
chrism@digicool.com
Mon, 27 Dec 1999 20:11:49 -0500
Timothy,
I doubt you're going to want to dtml-call a select query (as nothing
will be returned). You probably rather would like to call the select
query and print fields contained in records within the query response.
To iterate through the records returned from a SQL method which isn't
directly in the acquisition path, you can do the following:
<dtml-in "FWF_Scale.Categories.CategorySelectQuery">
<--! next is example, i have no idea what fields are returned -->
<dtml-var categoryname>
<dtml-var categoryid>
</dtml-in>
That should print the staff that (fictionally) resides in the fields
"categoryname" and "categoryid" for each record returned by the query.
More generally, when you need to refer to an object that isn't directly
in the acquisition path (e.g. you have to refer to it my a qualified
name), the most common way of referring to it is to refer to it
python-style (path.to.my.object) within quotes after dtml-call, dtml-in,
dtml-with, dtml-var, etc. which forces Zope to evaluate the stuff in the
quotes as a Python expression.
Note that you can use this snippet of DTML from a path that's (for
example) 100 levels deep into a big site, because acquisition handles
finding the first object in the qualifying path (in your case
"FWF_Scale"). As long as Zope can find this object through acquisition,
you can use that piece of DTML anywhere within your site.
HTH,
Chris
Timothy Grant wrote:
>
> Hi,
>
> Here's another one of those questions that has probably been asked a
> thousand times:
>
> I have a structure that looks like this
> ROOT
> /FWF_Scale
> /Categories
> CategorySelectQuery(SQL Method)
> /Grades
> GradeForm(DTML Method)
>
> I would like to write some DTML that will call CategorySelectQuery()
> from withing GradeForm.
>
> I have tried:
>
> <dtml-call FWF_Scale.Categories.CategorySelectQuery()>
> <dtml-call FWF_Scale/Categories/CategorySelectQuery()>
> <dtml-call /FWF_Scale/Categories/CategorySelectQuery()>
>
> all to no avail, what am I missing here?
>
> Thanks.
>
> --
> Stand Fast,
> tjg.
>
> Chief Technology Officer tjg@exceptionalminds.com
> Red Hat Certified Engineer www.exceptionalminds.com
> Avalon Technology Group, Inc. (503) 246-3630
> >>>>>>>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<<
>
> _______________________________________________
> 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 )
--
Chris McDonough
Digital Creations, Inc.
Zope - http://www.zope.org