[Zope] Getting calling folder data into a ZClass addForm
Tres Seaver
tseaver@palladion.com
Sat, 09 Jun 2001 10:22:06 -0400
complaw@hal-pc.org wrote:
> Is there any way for the addForm DTML Method for a ZClass to know what folder it
> was called from so that some DTML logic can be implemented to load certain data
> (for properties) into the input elements of the HTML form used to load the
> initial data into the soon-to-be created object instance?
>
> Is the context object available in the standard ZClass addForm?
>
> I want to make a generalized ZClass that references other class instances that
> exist within the calling folder (and no where else). The references,
> preferrably, would be stored in a list property of the object.
>
> The alternative is to make ZClasses for each specific folder (with boolean
> properties relating indicating relationship with the other object(s) in the
> folder). I would like to avoid the alternative because it is more maintenance.
>
> Does anyone use a mechanism for maintaining relationships between some (but not
> all) objects in a folder in some object for dynamic referencing?
>
> When you think about it, there is a lot of utility if someone can work out this
> trick.
>
> Thanks in advance,
Hi, Ron,
The DTML factory form is called in the context of a "factory dispatcher",
atop the "product dispatcher, atop the folder. You can get to the
real folder with PARENTS[1], e.g.::
<h3> Siblings: </h3>
<dtml-with expr="PARENTS[1]">
<dtml-in objectIds>
<dtml-if sequence-start>
<ul>
</dtml-if>
<li> <a href="&dtml-sequence-item;">&dtml-sequence-item;</a> </li>
<dtml-if sequence-end>
</ul>
</dtml-if>
</dtml-in>
</dtml-with>
Hope that helps.
Tres.
--
===============================================================
Tres Seaver tseaver@digicool.com
Digital Creations "Zope Dealers" http://www.zope.org