Re: [Zope-dev] Recursively adding ZClasses (continued)
- Original Message - From: "Rik Hoekstra" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 07, 2000 4:28 AM Subject: [Zope-dev] Recursively adding ZClasses (continued) First I had a problem with nested ZClasses, which got me into trouble when I wanted to add ZClasses to each other. So I followed the 'common wisdom' of adding all ZClasses at the top level of the product. THis generally works OK, and you can add ZClass instances to each other from the management interface. So far so good. WHere things go wrong is by recursively adding ZClasses, as in: the following pseudo code for ParticularZClass with some NestedZClasses inside: (Particular ZClass constructor has the following action sequence): create ParticularZClass instance set some properties in somelist set some other properties into REQUEST create NestedZClass instances whatever reading and following every piece of documentation I could get on this (not much), I never got any further than adding the NestedZClasses instances on the _same_ level as the ParticularZClass. No dtml-with "manage_addProduct['whatever']" (which contrary to documentation should have the containing product and not the ZClass as the 'whatever' argument) could help me out. 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... Kevin ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] Recursively adding ZClasses (continued)
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 - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] Recursively adding ZClasses (continued)
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 - [EMAIL PROTECTED] 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. ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )