I'm working on my first zope product and, while everything has gone relatively smoothly so far, I'm having some issues. The product is a folderish object which contains 3 subfolders, each of which contains a specific type of object. The structure looks something like this: work/: Main folder, UI, etc jobs/: List of all jobs projects/: taskforces/: Each folder contains a job, project or taskforce object, as well as the UI to manage them. Projects and taskforces are simple objects with names, descriptions, etc. Logic will be attached to these classes so that, when instances are viewed, they will search for jobs which are assigned to them. Each job can be assigned to multiple projects/taskforces. Now, the difficulty. I'm working on the UI for the job add form, which is in work/jobs. The form needs to iterate over the contents of projects/ and taskforces/, and I can't figure out how. Here's what I've tried: <tr> <th align="LEFT" valign="TOP">Taskforces</th> <td align="LEFT" valign="TOP"> <select multiple name="taskforces:list"> <dtml-in "PARENTS[1].taskforces"> <option value="<dtml-var id>"><dtml-var title_or_id</option> </dtml-in> </select> </td> </tr> <tr> <th align="LEFT" valign="TOP">Projects</th> <td align="LEFT" valign="TOP"> <select multiple name="projects:list"> <dtml-in "PARENTS[1].projects"> <option value="<dtml-var id>"><dtml-var title_or_id</option> </dtml-in> </select> </td> </tr> And the error I get is: | |Error Type: TypeError | | |Error Value: unsliceable object | Traceback (innermost last): File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/lib/zope/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: ESPWorkRequestAdd) File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: ESPWorkRequestAdd) File /usr/lib/zope/lib/python/App/special_dtml.py, line 120, in __call__ (Object: ESPWorkRequestAdd) File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__ (Object: ESPWorkRequestAdd) File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 672, in renderwob (Object: PARENTS[1].taskforces) File /usr/lib/zope/lib/python/OFS/ObjectManager.py, line 617, in __getitem__ (Object: RoleManager) File /usr/lib/zope/lib/python/OFS/ObjectManager.py, line 257, in _getOb (Object: RoleManager) TypeError: (see above) Can anyone offer any advice?
<dtml-with jobs> <dtml-in "objectValues('JobsZClass')"> <option value="<dtml-var id>"><dtml-var title_or_id></option> </dtml-in> </dtml-with> same thing for taskforces your error from what you tried was because you were trying to treat the taskforce and job folder objects as lists which they aren't. what you had would work, if you changed your <dtml-in> to reference the respective folders objectValues method which will return a list of objects which <dtml-in> will iterate over. kapil On Tuesday 30 January 2001 15:12, Nolan Darilek wrote:
I'm working on my first zope product and, while everything has gone relatively smoothly so far, I'm having some issues.
The product is a folderish object which contains 3 subfolders, each of which contains a specific type of object. The structure looks something like this: work/: Main folder, UI, etc jobs/: List of all jobs projects/: taskforces/:
Each folder contains a job, project or taskforce object, as well as the UI to manage them.
Now, the difficulty. I'm working on the UI for the job add form, which is in work/jobs. The form needs to iterate over the contents of projects/ and taskforces/, and I can't figure out how. Here's what I've tried:
participants (2)
-
ender -
Nolan Darilek