[Zope] How to use a ZSQLMethod from a Python Script

Igor Leturia IGOR@emun.com
Mon, 29 Apr 2002 12:02:28 +0200


>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:
> >=20
> >     res =3D context.mysqlmethod()
> >=20
> >   It gives an error message, 'resource not found'. Both the=20
>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.=20
Resource not found
Sorry, the requested resource does not exist.
Check the URL and try again.
------------------------------------------------------------------------
--------
Troubleshooting Suggestions
The URL may be incorrect.=20
The parameters passed to this resource may be incorrect.=20
A resource that this resource relies on may be encountering an error.=20
For more detailed information about the error, please refer to the HTML
source for this page.=20
If the error persists please contact the site maintainer. Thank you for
your patience.=20
=20
  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