Creating subobjects Programmatically in a ZClass Instance
Morning everyone.... What I am trying to do today is to create subobject in a Folderish ZClass (much like OFS:Folder automagically create and acl_uer folder and an index_html), but I cannot find an example.... To illustrate, I create a ZClass folder deived instance called "FOO" Then within my new instance of "FOO" I want to create another ZClass folder derived instance called "BAR" All of this when the user creates the instance FOO Note that I am working right now and if you got a down and dirty solution, please send it here or just post to the list and I'll pick it up when I get home.... TIA WPH
What I am trying to do today is to create subobject in a Folderish ZClass (much like OFS:Folder automagically create and acl_uer folder and an index_html), but I cannot find an example....
To illustrate, I create a ZClass folder deived instance called "FOO" Then within my new instance of "FOO" I want to create another ZClass folder derived instance called "BAR"
All of this when the user creates the instance FOO
Quoth Appendix B: """ To create an object inside an object manager use |manage_addProduct|: self.manage_addProduct['OFSP'].manage_addFolder(id, title) """ Here, 'manage_addFolder' is the constructor for 'Folder' but you'd replace this with the constructor of your ZClass "BAR". (Note that 'self' refers to the ObjectManager to which you're adding an object. In a Python script, which I think is how you do methods in a ZClass, this is 'container' or 'context'.) Put that in the constructor of "FOO" and you got it. The actual mechanics of this I can't help you with, as I don't use ZClasses. --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
participants (2)
-
Bill Hewitt -
J. Cameron Cooper