[Zope] Newbie: One location for SQL-methods site-wide

Charlie Reiman creiman@kefta.com
Wed, 24 Jul 2002 09:47:07 -0700


Assuming I understand your issue, go here:

http://www.zopelabs.com/cookbook/1003151229

This will tell you how to access the root object. You can then just use
<whatever root accessor>.SQL.method. Or some complicated DTML syntax variant
of that.

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Thomas Weholt
> Sent: Wednesday, July 24, 2002 9:27 AM
> To: zope@zope.org
> Subject: [Zope] Newbie: One location for SQL-methods site-wide
>
>
> I got a folder called SQL in the root-folder containing SQL-methods I use
> site-wide. I got a DTML-method, taking two parameters, also in the
> root-folder I call site-wide using SQL-methods in the mentioned
> folder. When
> I try to use the DTML-method in a DTML-document in a sub-folder I get an
> error, saying "global name 'SQL' is not defined". The sub-folder contain a
> SQL-folder also, with SQL-methods used in that part of the site.
>
> I call my DTML-method like so in a DTML-document in a subfolder :
> <dtml-var expr="dmViewComments(com_object=1, com_object_id=coi)">
>
> The DTML-method dmViewComments in the root-folder look something
> like this :
> <dtml-call "SQL.sqlmViewComments(REQUEST)">
> <!-- and then some more code -->
>
> I need a way to store DTML- and SQL-methods in the root-folder
> and call them
> site-wide. Can I somehow make a special folder that makes it contents
> available site-wide, while being defined one place for easy maintenance?
>
> Best regards,
> Thomas
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>