Calling an python method from within a python method
Zopesters, Does anyone know if it is possible to call an internal python method (built with the Python Method object) from within an internal python method (also built with the Python Method object)? For example: I have an internal python method called convertDate built with the Python Method object. Inside this method I would like to call another internal python method called isLeapYear(). Can this be done, if so how? Thanks, DR
Dan Rusch wrote:
Does anyone know if it is possible to call an internal python method (built with the Python Method object) from within an internal python method (also built with the Python Method object)?
Well, sure! What I guess you're really asking is how to access the other method. You do that the same way as you would any other Zope object.
For example:
I have an internal python method called convertDate built with the Python Method object. Inside this method I would like to call another internal python method called isLeapYear(). Can this be done, if so how?
At the moment, you would need to pass a namespace such as '_' into convertDate, and call LeapYear as "_.LeapYear()". Once I get a round Tuit, I'm planning on allowing you to 'import LeapYear' or 'from otherFolder import LeapYear' and avoid passing the namespace in.
participants (2)
-
Dan Rusch -
Evan Simpson