How to write a ZClass constructor method in PythonScript?
Inside a ZClass A (extended from objectManager), I define another ZClass B, here is what's in the default contstructor dtml method for B: <dtml-with "B.createInObjectManager(REQUEST['id'], REQUEST)"> ... </dtml-with> Well, I rewrite it in PythonScript, and modify the factory and add_form to point to this new method. The script is like: req = context.REQUEST container.B.createInObjectManager(req['id'], req) I think the PythonScript verion is equivalent to the DTML verion. But in the experiment, the PythonScript complains that B is not a attribute of the container, i.e. an instance of ZClass A, while the DTML works fine. Why is the ZClass definition not exposed to PythonScript? Any hints please! Cheers Dirksen __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
Dirksen wrote:
I think the PythonScript verion is equivalent to the DTML verion. But in the experiment, the PythonScript complains that B is not a attribute of the container, i.e. an instance of ZClass A, while the DTML works fine. Why is the ZClass definition not exposed to PythonScript? Any hints please!
Try changing container to context and see if you have any more luck... cheers, Chris
--- Chris Withers <chrisw@nipltd.com> wrote:
Try changing container to context and see if you have any more luck...
cheers,
Chris
No, that doesn't work either. I've just discovered something. If my ZClass B extended from Portal Member ZClass (from Membership System Product), the definition of B is exposed to PythonScript! I started to suspect it's a bug of PythonScript. Any other clues? cheers Dirksen __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
participants (2)
-
Chris Withers -
Dirksen