[Zope] Dynamic Folders in <dtml-in>

Dieter Fischer dieter.fischer@grid-it.ch
Wed, 21 May 2003 17:49:21 +0200


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'>