[Zope-DB] Dynamically generate sql-query in ZSQL Method
Charlie Clark
charlie at egenix.com
Tue Apr 20 06:15:32 EDT 2004
Dear Adam,
it is always better to post to the list in case people don't have time to
reply and so that others might help / benefit.
I think you just need to allow your PythonScript to access this module. See
the readme in the PythonScript folder.
Charlie
On 2004-04-08 at 09:47:41 [+0200], you wrote:
> Dear Charlie,
>
> thanks for help,
>
> > 1) the standard Zope approach
> > from Products.ZSELMethods.SQL import SQL
> > methodId = 'sqlListEmployees'
> > setattr(self, methodId, SQL(methodId, '', 'employeesDB', 'Select * FROM
> >
> > employees'))
> > result =self.sqlListEmployees()
> >
> > The setattr() method calls a connection and allows you to create dynamic
> > SQL. If you have another call before this which returns the fields in
> > question then you should have everything you need.
> >
> > Please come back with a more specific question if you're still having
> > problems.
> >
> > Charlie
>
> I don't know if I have good understand this approach,
>
> I have create clear SQL Method with id sqlTest,
> than I create PythonScript with code:
>
> from Products.ZSQLMethods.SQL import SQL
> setattr(self, methodId, SQL(methodId, '',
> 'MySQL_database_connection',query))
> result =self.methodId()
>
> and Parameter list: methodId, query
>
>
> I have tried to test it and after putting arguments Zope asked me for login,
> I tried to use admin login and password, but It didn't work, I became:
>
> Error Type: Unauthorized
> Error Value: You are not allowed to access ZSQLMethods in this context
>
>
> so I think, that I have something bad understand,
>
> thanks again, best regards
>
> Adam
--
Charlie Clark
eGenix.com
Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the Zope-DB
mailing list