[Zope] Dynamic Folders in <dtml-in>

David Hassalevris bluepaul@earthlink.net
Wed, 21 May 2003 10:00:51 -0700


Try using

_.getitem('your assembled id name')

Its been awhile since i've used this, but I think its close to what you are
looking for.
DAvid

----- Original Message ----- 
From: "Dieter Fischer" <dieter.fischer@grid-it.ch>
To: "Zope@Zope.Org" <zope@zope.org>
Sent: Wednesday, May 21, 2003 8:49 AM
Subject: [Zope] Dynamic Folders in <dtml-in>


> Hello
>
> I have the following struture in my folders:
>
> sql - oracle
>     - postgresql
>     - odbc
>
> I've the idea to share most of the SQL-Methods via aqusition (they are in
> sql), but have the specific ones (not ANSI SQL) in the db folder (e.g
Oracle
> with it's to_date function.
>
> I've tried this statement for an <dtml-in>:
>
> <dtml-set query="sql.oracle.browse()">          #1 See bottom
> <dtml-in "query" size=12 start=query_start>
>
> which works fine.
>
> I'd like to have it more dynamicly, so I tried:
>
> <dtml-set query_string="'sql.'+getDatabase()+'.browse()'"> #1 See bottom
> <dtml-set query="_.getitem(query_string)"> #1 See bottom
> <dtml-in "query" size=12 start=query_start sort="code,bez">
>
> getDatabase is a Python-Script which get's the db for the folder
> (oracle,postgresql,odbc). But it doesn't find the object:
>
> Error Type: KeyError
> Error Value: sql.oracle.browse()
> This resource may be trying to reference a nonexistent object or variable
> sql.oracle.browse
>
> Anybody can give me an advice for the correct syntax?
>
> Thanks
>
> Dieter
>
> #1 I'm using the dtml-set tag, so
>
>    <dtml-call "REQUEST.set(foo, 10)">
>       is:
>    <dtml-set foo='10'>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )