Dear Zopistas,

i have an old zope application that present data from a database in such
a manner
<dtml-in "sql_methods.select_user()">
<dtml-var firstname><dtml-var lastname>

I had to change the methods that returned data from the database, and it
is no longer possible to return data directly from zsql methods. Instead
i read them in a script, perform some processing and return a dictionary
with exactly the same mappings. I thought the application would work
without any change but it seems this is not the case (variables in
dtml-in can not be found, kinda makes sense now, the dictionary values
are not properties...). So i created class that dynamically contain all
data returned from my script. The class is something like this

class foo:
 dct ={}
 def fill(self,temp_dct):
   self.dct = temp_dct
 def __getattr__(self,val):
   return self.dct[cal]

>From pure python it works fine. Unfortunately i can not use it in a zope
python script because of the __getattr__ method, so i put the class
definition in an external method and use it in the python script (it
returns an instance of the class). But dtml still returns me some
strange errors. First, when the instance is created/accessed, some
zope-like methods are called on it (for example getId, cant figure out
why), and even if i implement them (dummy) it returns me authorization

Any idea, or alternative solution would be more than helpful ;) My main
objective is not to change the zope application

Thank you....

PS sorry for the length of my mail, but it is kinda complicated problem :)

Dimitris Koukis
Software Engineer

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to