RE: [Zope] How to use a ZSQLMethod from a Python Script
Igor Leturia writes:
I want to call a ZSQLMethod from a Python Script. In Zope.org, I couldn't find a specific how-to on the subject, but accidentally I found some other how-to's in which there are examples that use ZSQLMethods from Python scripts. It seemed very easy, so I tried it that way:
res = context.mysqlmethod()
It gives an error message, 'resource not found'. Both the script and the sql method are in the same folder. What's going wrong?
Dieter Maurer writes:
When script and method are in the same folder, it may help to replace "context" by "container".
If it does not help, the precise error message (Error Type, Error Value and traceback) is necessary to help...
'container' doesn't work either. As for the error type and value, I don't know, this is the message I get: Site Error An error was encountered while publishing this resource. Resource not found Sorry, the requested resource does not exist. Check the URL and try again. ------------------------------------------------------------------------ -------- Troubleshooting Suggestions The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. I'm sure the URL is correct and the ZSQLMethod doesn't need any parameters. There isn't any name problem, as the ZSQLMethod's name is unique, I have never used it before. I'm completely lost. The only thing I can think of is that I need some import clause. Is that possible? Any ideas will be welcome. Thanks in advance, Igor Leturia
Igor Leturia writes:
.... Dieter Maurer writes:
If it does not help, the precise error message (Error Type, Error Value and traceback) is necessary to help...
'container' doesn't work either. As for the error type and value, I don't know, this is the message I get:
Site Error An error was encountered while publishing this resource. Resource not found Sorry, the requested resource does not exist. Check the URL and try again.
Please run your Zope in debug mode (start it with "-D" option). It will give you better error messages and tracebacks. I you do not want that, look at the HTML source. At least, Zope 2.5.0, still has a commented traceback in the HTML page source. Dieter
participants (2)
-
Dieter Maurer -
Igor Leturia