RE: [Zope-dev] call pythonscript from python
I was trying to call a PythonScript from a __getstate__ method of the object. That seems impossible since the object appears to be already unwrapped. Know of any ways to get back the wrapper after it has been disposed of? I'm trying to add a manage_afterPropertyChanged hook, and I think I've found another way to do it. Thanks for the help, Tim -Original Message- From: Evan Simpson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 21, 2001 10:41 AM To: Tim McLaughlin; [EMAIL PROTECTED] Subject: Re: [Zope-dev] call pythonscript from python From: "Tim McLaughlin" <[EMAIL PROTECTED]> > Anybody know how I can call a pythonscript from python? Currently I can > call it, but I seem to have no context or security context, because it > either will not let me access anything or fail with an attribute error in > the context. What are the params that I NEED to pass in so that it can do > its bindings (and if you know how to get them automagically, that would be > incredible)? How does the Python code get executed (External Method? Product?) and how does it get access to the Script? Calling a Script should indeed automagically give it context from its acquisition wrapper. Cheers, Evan @ digicool ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] call pythonscript from python
Tim McLaughlin wrote: > > Anybody know how I can call a pythonscript from python? Currently I can > call it, but I seem to have no context or security context, because it > either will not let me access anything or fail with an attribute error in > the context. What are the params that I NEED to pass in so that it can do > its bindings (and if you know how to get them automagically, that would be > incredible)? > > Tim > The Bindings parent class of PythonScript defines a method __render_with_namespace__(namespace) that looks like it grabs the arguments and bindings from whatever namespace mapping you provide it and then executes the script. You could also use the _bindAndExec(args, kw, caller_namespace) method if you want to also pass arguments from outside the namespace. Take at looksie at lib/python/Shared/DC/Scripts/Bindings.py for the source. -- | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `--> ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] call pythonscript from python
From: "Tim McLaughlin" <[EMAIL PROTECTED]> > Anybody know how I can call a pythonscript from python? Currently I can > call it, but I seem to have no context or security context, because it > either will not let me access anything or fail with an attribute error in > the context. What are the params that I NEED to pass in so that it can do > its bindings (and if you know how to get them automagically, that would be > incredible)? How does the Python code get executed (External Method? Product?) and how does it get access to the Script? Calling a Script should indeed automagically give it context from its acquisition wrapper. Cheers, Evan @ digicool ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] call pythonscript from python
Anybody know how I can call a pythonscript from python? Currently I can call it, but I seem to have no context or security context, because it either will not let me access anything or fail with an attribute error in the context. What are the params that I NEED to pass in so that it can do its bindings (and if you know how to get them automagically, that would be incredible)? Tim ___ Tim McLaughlin BCSwebservices.net Director, Technical Group 1950 Old Gallows Road tel: (703) 790.8081 x111 Suite 201 [EMAIL PROTECTED] Vienna, VA 22182 www .bcswebservices. net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )