Quoting Lee Reilly CS1997 <lreilly@cs.strath.ac.uk>:
Hi,
I have a TINY problem, which I think there is a simple solution too... but for the life of me, I can\'t find it! I\'d be grateful if someone could point me in the right direction.
I have a database setup containing details of classes, students & lecturers. The user is prompted to enter a class code (a unique key) which is used to query the database and return the class title. Simple.
A DTML method prompts me for the class code -- I enter 52.139 and it posts to a method \'enterClassCodeAction\', below.
#1 <dtml-var standard_html_header> #2 <h2>Confirm</h2> #3 <p>You entered <i><dtml-var class_code></i></p> #4 #5 <p> #6 Our records show that <dtml-var class_code> is called #7 #8 <dtml-in expr=\"findClassTitle(code=52.139)\">
RING: dont do that, dtml wont work in python namespace instead, remember that in python namespace all vars present in dtml namespace are inherited. do this: <dtml-in expr=\"findClassTitle(code=_.(\'class_code\'))\"> the __.() construct is required since underscore arent allowed in python variable names. if the var was called classcode, you could do <dtml-in expr=\"findClassTitle(code=classcode)\"> dats it.
#9 <dtml-var title> #10 </dtml-in> #11 #12 #13 </p> #14 <dtml-var standard_html_footer>
^ The method works fine when the class code is manually inserted (line #8) but when I try to pass the variable from the previou post, held in <dtml-var class_code> I have probs.
<dtml-in expr=\"findClassTitle(code=<dtml-var class_code>)\"> *** syntax error
findClassTitle is a ZSQL method for returning the class title given a class code:
select title from classes where <dtml-sqltest code op=eq type=float>
Hmm... anyone see the problem?
Thanks a lot :)
- Best regards,
Lee
_______________________________________________ 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 )
---------------------------------------------------------- Universidad Federico Santa Maria - Campus Guayaquil Enviado por: www.usm.edu.ec/computacion