[Zope] Something missing in Python Methods

Pierre-Julien Grizel grizel@mouli.net
Tue, 02 Jan 2001 15:31:15 +0100


Hi, Curtis...


You're right for the word "method"... But that's in fact why they are
not called "methods" anymore ! :-))

Don't blame Python Script team : it's a non-trivial problem, both for
security and... feasibility reasons !

I don't know wether it actually works for Python Methods, but you should
try to pass your environment, just as you would for DTML Methods, like
this :

<dtml-var "MyPythonMethod (_.None, _)">


And then you should gain access to Zope environment. But remember this
is not elegant and may lead you to security problems.



Regards,


P.-J.


Curtis Maloney wrote:
> 
> Greetings
> 
> Yeh, yeh.. I know.. I should be using Python Scripts, or whatever... but for
> various reasons, I'm still using 2.1.6...
> 
> What I want to know is, why can't Python Methods refer to anything not
> explicitly passed to them?  I don't want to have to make everything that
> invokes the method have to know to pass it half a dozen objects.
> 
> Isn't the idea of a method to be executed in the namespace of it's parent?  I
> want my method to be able to access objects in it's own folder...
> 
> What am I missing?
> 
> Curtis
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 
If the only tool you have is a hammer, 
    you tend to see every problem as a nail.
Si le seul outil dont vous disposez est un marteau, 
    vous avez tendance à voir chaque problème comme un clou. 
                                       --Abraham Maslow