Daryl Stultz wrote:
Tim Cook wrote:
Daryl,
Import the DarylProduct.zexp into your Products folder.
The DarylExample.zexp can go anywhere in you Zope tree.
As luck would have it, the file did not import into Products (File
/usr/local/Zope/lib/python/OFS/CopySupport.py, line 406,
Daryl Stultz wrote:
It DID import into the root folder (I did this purely by accident!) I
was then able to recreate the called-for classes and IT WORKED!! I
haven't figured out HOW yet but I will. Thanks a lot for the help, and
Maybe we COULD say the how is, "because it creates one object(
Tim Cook wrote:
Daryl,
Import the DarylProduct.zexp into your Products folder.
The DarylExample.zexp can go anywhere in you Zope tree.
As luck would have it, the file did not import into Products (File
/usr/local/Zope/lib/python/OFS/CopySupport.py, line 406, in
_verifyObjectPaste)
It DID
Tim Cook wrote:
Well, Tim, I'm sorry to say I am back where I started :-(
I took your (working) example and modified it. I want to be able to add
the MyClass1/MyClass2 combo from the management interface (the add
product thing).
I combined all the code into MyClass1_add. If I use this:
Daryl Stultz wrote:
Tim Cook wrote:
The problem here is that even though you set REQUEST, it is a
string. You need to be in the context of the parent _object_. You
should try dtml-with "_.getitem(parent_id)".
What's happening now is that my class2 is getting created at the same
Daryl Stultz writes:
"REQUEST.set" to influence where instance is created
"createInObjectManager" is uninterested in "REQUEST".
It creates the new object (usually, exception when its object
has a special "Destination" attribute) in the parent (aq_parent)
of its object.
Your
Daryl Stultz writes:
Tim Cook wrote:
The problem here is that even though you set REQUEST, it is a
string. You need to be in the context of the parent _object_. You
should try dtml-with "_.getitem(parent_id)".
Sorry, I thought of more...
It's my understanding that dtml-with
Tim Cook wrote:
I guarantee that you will end up with a folder MyClass1ID that
contains MyClass2ID.
You've been very helpful, here, Tim, but I simply can't get this to
work. I'm wondering if you might be able to create such a product for me
and send it to me: One product with two classes,
Daryl Stultz wrote:
Tim Cook wrote:
I guarantee that you will end up with a folder MyClass1ID that
contains MyClass2ID.
You've been very helpful, here, Tim, but I simply can't get this to
work. I'm wondering if you might be able to create such a product for me
and send it to me: One
Tim Cook wrote:
Next we get the newly constructed MyClass1, and setup to call the
MyClass2 constructor:
dtml-with "_.getitem('id')"
dtml-call expr="REQUEST.set('id', 'MyClass2ID')"
dtml-with "manage_addProduct['MyCoolProduct']"
dtml-call expr="MyClass2_add(_.None, _,
Daryl Stultz writes:
I have a product folder called "TestClass" with 2 ZClasses: class1 and
class2.
The following is an exerpt from the class1 constructor:
dtml-with "class1.createInObjectManager(REQUEST['id'], REQUEST)"
dtml-call "REQUEST.set('id', 'myClass2')"
dtml-call
You should look at the source of your "class2_add",
especially the constructor that creates the object.
I expect, that you use "class2.createInObjectManager"
to create your "class2" instance.
"C.createInObjectManager" usually uses "C.aq_parent" to
determine the object manager where the
Daryl Stultz wrote:
I want class2 to be created INSIDE of the class 1 instance. Instead,
class2 (always with an id of "myClass2") is created at the same level as
the class1 instance. How do I change the namespace to get the class2
instance inside class1?
NOT TESTED, but simialr to
Tim Cook wrote:
NOT TESTED, but simialr to something I do:
dtml-call expr="class1.createInObjectManager(REQUEST['id'],
REQUEST)"
dtml-with "_.getitem(id)"
dtml-call "REQUEST.set('id', 'myClass2')"
dtml-call "class2_add(_.None, _, NoRedir=1)"
/dtml-with
Hmmm, doesn't seem to be
14 matches
Mail list logo