a question about python and DtmlMethod in ZOPE
hello. I want to return a dtmlMethod in a python script in Zope as follow, but I failed. the python script is: ----------- stuff = 'Nom;Prenom;Adresse;Téléphone;Email \n' for result1 in context.DataBase.Query_cand.liste_all_dossiers(): for result2 in context.DataBase.Query_cand.liste_info_dossier(nom_user=result1.c_user name): stuff = stuff + result2.nom + ';' stuff = stuff + result2.prenom + ';' stuff = stuff + result2.adresse + ';' stuff = stuff + result2.tel + ';' stuff = stuff + result2.email + '\n' context.manage_delObjects('Data_cand') context.manage_addFile('Data_cand') context.Data_cand.manage_edit('Données de la table Candidats','application/msword','',stuff) return context.Data_cand_view ----------- in which the 'Data_cand_view' is a DtmlMethod, but it isn't returned.
Hi all I am a newbie in Zope and ZPT. I want to pass an argument from ZPT via python which in turn passes it to a ZSQL method to make a query in the database based on that argument. Any solutions even with DTM ZSQL is also acceptible to me. Please help me out Thaking u all Exteam SMS using the Yahoo! Messenger;Download latest version.
On 26.Jun 2003 - 13:51:55, Exteam wrote:
Hi all
I am a newbie in Zope and ZPT.
I want to pass an argument from ZPT via python which in turn passes it to a ZSQL method to make a query in the database based on that argument.
Hmm, don't know If I understand you, but I would call the script with the parameter like this: python:scriptname(parameter=variable) Then in the script you can do the same qith the ZSQL Method: context.zsqlmethod(parameter) Andreas -- Questionable day. Ask somebody something.
Andreas Pakulat wrote at 2003-6-26 15:03 +0200:
On 26.Jun 2003 - 13:51:55, Exteam wrote:
Hi all
I am a newbie in Zope and ZPT.
I want to pass an argument from ZPT via python which in turn passes it to a ZSQL method to make a query in the database based on that argument.
Hmm, don't know If I understand you, but I would call the script with the parameter like this: python:scriptname(parameter=variable) Then in the script you can do the same qith the ZSQL Method: context.zsqlmethod(parameter)
ZSQLMethods require keyword arguments. Dieter
leiz@esiee.fr wrote at 2003-6-26 14:29 +0300:
... I want to return a dtmlMethod in a python script in Zope as follow, but I failed.
the python script is: ... return context.Data_cand_view -----------
in which the 'Data_cand_view' is a DtmlMethod, but it isn't returned.
Are you sure? What is returned? The "return" above does return the DTMLMethod object (!). This may result in a cryptic error message (indication the the ZPublisher was unable to convert the object into a string) or (earlier Zope versions) result in an apparently empty page (when you look at the page source, you will see "<DTMLMethod instance at ...>"). What you probably want is not to return the DTMLMethod itself but the result of rendering the method. In this case, use return context.Data_cand_view(context,container.REQUEST) Dieter
participants (4)
-
Andreas Pakulat -
Dieter Maurer -
Exteam -
leiz@esiee.fr