[Zope-dev] Use Z SQL methon in projects

Dieter Maurer dieter at handshake.de
Mon Mar 29 17:38:42 EST 2004


R33t wrote at 2004-3-27 17:35 +0000:
> ...
>I did all the things so far inside the Zope ZMI to see how things work
>together, but now I'd like to create a "real" project and I already got
>most of the things working, like calling the page templates from within
>python. The problem I have now is that I don't know how to manage to
>export my Z SQL method getNewsletters to my product folder and register
>it to Zope from within python when my product gets installed, so that
>the template can call this method like before

Create your Z SQL Methods as class attributes in your product class.
You can then access them like all other attributes of your instances.

You are not able to use the standard "manage_addZSQLMEthod".
Use instead:

    from Products.ZSQLMethods.SQL import SQL

    class MyClass(...):
      ...
      mySQLMethod = SQL(id, title, connection_id, arguments, template)


-- 
Dieter



More information about the Zope-Dev mailing list