[Zope-dev] Recursively adding ZClasses (continued)

Jason Spisak 444@hiretechs.com
Wed, 07 Jun 2000 18:27:10 GMT


Rik Hoekstra writes:

This currently adds recursive ZClasses for me.  All ZClasses are on the top
level of the Product, no nesting:

<cut out untested>

<dtml-with "PermanentJobClass.createInObjectManager(REQUEST['id'],
REQUEST)">
 <dtml-call "propertysheets.PermanentJob.manage_editProperties(REQUEST)">
 <dtml-call "propertysheets.Job.manage_editProperties(REQUEST)">
 <dtml-call "propertysheets.Searchable.manage_editProperties(REQUEST)">
 <dtml-with "manage_addProduct['ZGL']">
  <dtml-with "ServiceClass.createInObjectManager(_.getitem('unique_id', 1),
REQUEST)">
   <dtml-call "propertysheets.Service.manage_changeProperties(REQUEST)">
   <dtml-with "manage_addProduct['ZGL']">
    <dtml-with "ItemClass.createInObjectManager(_.getitem('unique_id', 1),
REQUEST)">
 <dtml-call "propertysheets.Item.manage_changeProperties(
                price=REQUEST['price'],
                description='Placement Fee',
                )">
     <dtml-with "manage_addProduct['ZGL']">
      <dtml-with
"ComponentClass.createInObjectManager(_.getitem('unique_id', 1), REQUEST)">
        </dtml-in default_overrides>
       </dtml-with>
      <dtml-call reindex_object>
      </dtml-with>
     </dtml-with>
     <dtml-call reindex_object>
    </dtml-with>
   </dtml-with>
   <dtml-call reindex_object>
  </dtml-with>
 </dtml-with>
 <dtml-call reindex_object>
</dtml-with>
</dtml-with>
<dtml-call "RESPONSE.redirect(URL1 + '/' + REQUEST['id'])">

</cut out untsted>
I cut a few things out that didn't have to do with the recursing, but you
bet the general picture.

All my best,


> <snip>
> 
> Thanks for replying Kevin, but it won't work ;-( I tried it ALL, and it
> _will_not_work_. The nested ZClasses will apparently solve it (I used it
> elsewhere), but it will get you into trouble in other situations - if
> you want to add an instance of the nested zclass to an existing instance
> of that same nested zclass. I had to change my product before because of
> that.
> 
> > 
> > I'm using nested ZClasses in KM|Net News. Take a look at the AddArticle
> > method. In KMNN, these ZClasses are set up as nested ZClasses, so that may
> > change things somewhat. However, it may still work. Rather than doing
> > manage_addProduct[], you *might* be able to just directly call
> > ZClass_add(_.None, _), because it could be in your acquisition path at the
> > top of the product. In KMNN, that's all I had to do, but in that case the
> > ZClass_add method was located within the ZClass that was to contain it.
> > 
> > That sounded kind of rambling, so I hope it makes sense...
> 
> No matter if you use ZClass_add directly or in  dtml-with. No matter if
> you close the first dtml-with and open another. No matter if you
> redirect to get out of namespace problems (that will _really_ give
> strange errors). Believe me, it was a _very_ frustrating experience (and
> I really wanted to refrain from ranting -just couldn't help myself)
> 
> thanks again for replying
> 
> Rik
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
> 


Jason Spisak
CIO
HireTechs.com
6151 West Century Boulevard
Suite 900
Los Angeles, CA 90045
P. 310.665.3444
F. 310.665.3544

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.