I'm building an application dealing with multiple Departments, each with multiple members. Here's a short diagram of the folders in question Department (department level information and forms) +--Members (department Roster) +--Individual (individual level information and forms) +--Status (tracks status information and history) The Members index_html (dtml_method) displays all of the active members (stored in a mySQL database), displaying each member as a link as follows ("Get" is a Z_SQLMethod) <ul> <dtml-in Get> <li><a href = "myserver/Individual?member_number=&dtml-member_number;>&dtml-name;</a> </dtml-in> </ul> This calls the Individual/index_html (a dtml_method), passing it member_number as expected. The Individual folder has a link allowing the user to add a status value for the individual <a href="myserver/Memebrs/Individual/Status/AddForm/memno=&dtml-memno;;">Add Status</a><br> This calls a dtml_document which renders a form to add a status for the individual. This form calls Status/Add (a dtml method) which in turn calls AddSQL (an Z_SQLMethod) to post the data to the database. <dtml-var my_header> <dtml-call "AddSQL()"> <dtml-call "RESPONSE.redirect('Status')> <dtml-call my_footer> This post the data to my Status table, but fails on th redirect. The problem I'm encountring is the redirect fails because the Status/index_html cannot find member_number. I thought that member_number would be in the Individual namespace, but it's nowhere to be found. Since the Individual folder will eventually have a lot of sub-folders (Addresses, Phones, Equipment, etc.) I would really like to use Acquisition rather than passing member_number explicitly. I've re-read the sections in "The Zope Bible" (pp 72+), "Web Application Construction Kit" (pp 82+), and "The Zope Book" (multiple places), but I guess I just don't get it. How and Where do I set the member_number so that all of the sub-folders can "see" (acquire) it? Thanks for your time and help. Greg Lindstrom Vilonia, Arkansas
On Sat, 2003-06-07 at 06:29, Greg & Janet LINDSTROM wrote:
How and Where do I set the member_number so that all of the sub-folders can "see" (acquire) it?
The general answer is that some object on the acquisition path needs to provide the name "member_number". The acquisition path is determined by performing the following steps in order: 1. Search the folder immediately containing the called object. 2. Repeat the search for each parent folder, up to the root. 3. Search by context, looking for the required name in every object to the left of the called object in the request URL, working right to left. The most transparent way to make this work predictably is to have an object (script, template, file, etc) called member_number that is at the highest point in the folder hierarchy over which it is meant to apply. E.g.: / A/ member_number B/ member_number C/ D/ Any request made of any object in B, C, or D will use the value of member_number acquired from the member_number object in B. Any child of A will use A's member_number object. Another variant is to provide some other kind of object that has a member_number property/method and ensure that this object is on the acquisition path. E.g.: / A/ info method The "info*" object is able to provide the name "member_number". Assuming member_number is required for success, this request will work: http://server/A/info/method But this one will not: http://server/A/method The first succeeds because it places an object on the acquisition path that is able to resolve a required name member_number. In the second example, neither method nor A nor the root folder provides member_number and the request will fail. It may help to think about the first URL as resolving method *in the context* of info. HTH, Dylan
participants (2)
-
Dylan Reinhardt -
Greg & Janet LINDSTROM