[Zope] Composite Objects?
Paul Winkler
pw_lists at slinkp.com
Mon Apr 11 21:05:23 EDT 2005
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
More information about the Zope
mailing list