Hello all.

First, a warning: I'm probably the newest of all Zope newbies. I'll do
my best to formulate some semblance of an intelligent question.

I'm having a namespace meltdown. Here's what's going on...

I have a ZClass called "Company" which has attribute "id", and a ZClass
called "Project" which has attribute "CompanyID" among others.

I'm trying to call and render only those Projects that have a CompanyID
that matches the Company object's "id" attribute. I'm doing this in the
"index_html" of the Company ZClass by calling a DTML Method
"retrieveCompanyProjects"... which resides in the folder "Company_List".
Here's the pertinent tree structure:

                retrieveCompanyProjects (DTML Method)

        Control Panel/
                                Company (ZClass)
                                Project (ZClass)


Now... the procedure is successful when rendering only those Projects
that match a specific FSSession userid, as such:

## DTML Method 1 Excerpt:

<dtml-in "Projects.retrieveUsersProjects(_.None, _)">

## "retrieveUsersProjects" DTML Method Excerpt:

<dtml-call "REQUEST.set('list', [])">

<dtml-in "Projects.objectItems(['Project'])">
<dtml-with sequence-item>

<dtml-if "Engineer == FSSession['userid']">

        <dtml-let x=sequence-key>
        <dtml-call "list.append(absolute_url())">
        succeed <dtml-var ApplicationEngineer>, <dtml-var "this()">
        fail <dtml-var ApplicationEngineer>


I've tried to use the same mechanism in the "retrieveCompanyProjects"
DTML Method, and here's where the namespace meltdown turns my brain to mush.

Here's the "retrieveCompanyProjects" DTML Method, which (to reiterate)
is called from the "index_html" method inside the Company ZClass:

<dtml-call "REQUEST.set('list', [])">

<dtml-in "Projects.objectItems(['Project'])">
<dtml-with sequence-item>


        <dtml-let x=sequence-key>
        <dtml-call "list.append(absolute_url())">
        succeed <dtml-var CompanyID>, <dtml-var "this()">
        fail <dtml-var CompanyID>

<dtml-return "REQUEST['list']">

My problem is that I can't for the life of me figure out what to replace
the "COMPANY_ATTRIBUTE_NAMED_ID" with in order to make it work.
User-specific is easy... it's simply FSSession['userid'].

Due to the position of the <dtml-if> following the <dtml-in>, however,
I'm in the namespace of Projects, right? That being considered, the
property "id" is at that point the "id" of the Project, and not of the
Company anymore, no?

How can I go out, and snag a Company's property "id" from within that
namespace? Can I do a <dtml-with> ??? </dtml-with> to pop the Company
namespace on the top of the stack & kick it out after getting the "id"?

Or, alternatively, is there a way that I can pass the variable "id" from
the Company namespace into the DTML method so it's there, recognized,
and used to filter the Projects?

Sorry this was so long, but any help would be greatly appreciated. I'm confused.

Gary Perez
Advanced Simulation Technology, inc.

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to