Re: [Zope] Composite Objects?
On Mon, Apr 11, 2005 at 04:43:38PM -0400, Jeffrey E. Forcier wrote: I'm attempting to use mostly-vanilla Zope to implement an intranet here at my office, but am finding it difficult to use a 'feature' that I imagine should be possible. I've created a template for what ideally would be a single object/class type, containing multiple different kinds of Zope objects, and want to be able to clone new copies of that template as one can do with the existing Zope objects (e.g. as one would add a new File or Folder). (snip) I gather you want to be able to modify the scripts and such for each copy, which argues against the usual solution of building a Product. You might check out AbracadabraObject, which seems tailor-made for your use case. -PW -- Paul Winkler http://www.slinkp.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Composite Objects?
On Mon, Apr 11, 2005 at 04:56:04PM -0400, Jeffrey E. Forcier wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul Winkler wrote: (snip) I gather you want to be able to modify the scripts and such for each copy, which argues against the usual solution of building a Product. Actually, no--the only thing that would change per-instance would be the Formulator form and, of course, the underlying data. The logic, as scripted in the Python Scripts, would be the same for all instances. In that case, I'd write a filesystem Product for the logic. Replace the scripts with methods of the Product class. Make it folderish so it can contain Forumator forms and anything else you want: inherit from Folder and use its UI to manage contents. You could then use AbracadabraObject to clone instances of this thing; or you could do it all in code and have a manage_afterAdd method that adds a preconfigured Formulator form. Source and/or docs of Formulator should give you a clue how to instantiate one with the right config. -- Paul Winkler http://www.slinkp.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Composite Objects?
Paul Winkler wrote: In that case, I'd write a filesystem Product for the logic. Replace the scripts with methods of the Product class. Make it folderish so it can contain Forumator forms and anything else you want: inherit from Folder and use its UI to manage contents. You could then use AbracadabraObject to clone instances of this thing; or you could do it all in code and have a manage_afterAdd method that adds a preconfigured Formulator form. Source and/or docs of Formulator should give you a clue how to instantiate one with the right config. That's kind of what I was thinking. AbracadabraObject appears to have a method call that allows you to use its magic in code, which I think is exactly what I want, although as before I'm very surprised that this sort of functionality doesn't exist in Zope proper. I guess my desires aren't actually all *that* in-line with the main body of Zope users, as I do *not* want the users of this application to ever see a ZMI screen. So I need this half-and-half situation where I or another admin can tweak some aspects of a class (e.g. Formulator forms, ZPT) via the ZMI or WebDAV, but the instances of those objects are instantiated *via code only*, by Python logic and my own (ZPT-driven) HTML form interface. Another possibly far-fetched feature I'd like, which again I believe was part of ZClasses, would be to be able to tweak the instances' Formulator forms after the fact...e.g. add another data field a year down the road. Of course this then means that I both do and don't want these cloned forms to match up with the central one, and I'm not at all sure that I can accomplish this without writing lots of my own code to handle it. Thanks for the help, by the way, it's appreciated. Regards, Jeff ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Composite Objects?
On Mon, Apr 11, 2005 at 08:36:22PM -0400, Jeffrey E. Forcier wrote: Paul Winkler wrote: In that case, I'd write a filesystem Product for the logic. Replace the scripts with methods of the Product class. Make it folderish so it can contain Forumator forms and anything else you want: inherit from Folder and use its UI to manage contents. You could then use AbracadabraObject to clone instances of this thing; or you could do it all in code and have a manage_afterAdd method that adds a preconfigured Formulator form. Source and/or docs of Formulator should give you a clue how to instantiate one with the right config. That's kind of what I was thinking. AbracadabraObject appears to have a method call that allows you to use its magic in code, which I think is exactly what I want, although as before I'm very surprised that this sort of functionality doesn't exist in Zope proper. Well, it's not really all that hard. Googling ZopeLabs turns up a bunch of potentially relevant recipes. ...although, i cheated and searched for the method names because I already know what they are :-) http://www.zopelabs.com/cookbook/1008971158 http://www.zopelabs.com/cookbook/1059840939 http://www.zopelabs.com/cookbook/1045607641 (for CMF, but works for any PropertyManager) http://www.zopelabs.com/cookbook/1022683717 I guess my desires aren't actually all *that* in-line with the main body of Zope users, as I do *not* want the users of this application to ever see a ZMI screen. That's not so unusual.. see for example CMF and all its offspring, e.g.CPS, Plone Another possibly far-fetched feature I'd like, which again I believe was part of ZClasses, would be to be able to tweak the instances' Formulator forms after the fact...e.g. add another data field a year down the road. to all of 'em? Traditionally we do this sort of thing via an iterator script. Something like: all = context.ZopeFind(context, obj_metatypes=['Formulator Form'], search_sub = sub) for form in all: form.callSomeMethod() # i'm too lazy to look up the formulator API Of course this then means that I both do and don't want these cloned forms to match up with the central one, and I'm not at all sure that I can accomplish this without writing lots of my own code to handle it. yep, there's no free lunch with that kind of problem. -- Paul Winkler http://www.slinkp.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )