[Zope] General ZOPE Programming Question

Jeff Hoffman jeff.hoffman@goingv.com
Sun, 5 Mar 2000 12:53:05 -0500 (EST)


On Sun, 5 Mar 2000, Michael Lausch wrote:

> I want to do the following tasks
> 
> A user enters a list of products. Such a list is equivalent to
> an order. Then i want the user to enter some things for each
> product. I don't want to implement DTML pages for each
> combination of products and i want to present one entry
> screen for each order.
> 
> I tried the following approach:
> I created a Folder named 'Products'. In this folder i
> created subfolders named after the prducts code number,
> e.g. `4007', `4008'., ....
> 
> In each of these folders i defined a DTML Method `New' which
> hholds the DTML code to create an input form fr this product. My
> plan is also to create methods named 'Display', 'Edit', .... so
> i can render the objects in different ways.
> 
> In anotehr page i want to do something like:
> 
> <dtml-in products>
>    <dtml-var "URL1 + '/Products/' + _['sequence-item'] + '/New'">
> </dtml-in>

Try (untested):

  <dtml-in expr="Products.objectValues()">
    <dtml-var expr="_['sequence-item'].New(_.None, _)">
  </dtml-in>

> So what's the correct method for implementig such a system?

I would investigate ZClasses. It seems to me like you could end up with a
"Product" ZClass (though I might call it something else to avoid confusion
with Zope Products), which contains your New, Edit, and Display methods.

Depending on how much each Product differs, you might have a
WidgetProduct, ThingamabobProduct, DoohickeyProduct, etc. Or, maybe you
can just get away with Product. I'd have to know more specifics to get
into detail.

--Jeff

---
Jeff K. Hoffman                                         704.849.0731 x108
Chief Technology Officer                                mailto:jeff@goingv.com
Going Virtual, L.L.C.                                   http://www.goingv.com/