Re: [Zope] sql query results -> DTML method problem
"Manuel Amador (Rudd-O) writes: > > #8 > > RING: dont do that, dtml wont work in python namespace > instead, remember that in python namespace all vars present in dtml namespace > are inherited. I do not see a reason, why not to use this (except, that " should not be escaped, of cause). > do this: > > the __.() construct is required since underscore arent allowed in python > variable names. if the var was called classcode, you could do "_" are allowed in Python names. They are treated in the same way as a letter. DTML restricts the use of "_": A name must not *START* with an "_" (unless it is the special name "_"). Inside name, you can use "_" freely. > > dats it. That said, you can also use: > > )\"> *** syntax > > error I agree with Manuel: you cannot nest DTML. And it is this nesting, that triggered his "RING: do not do that!" Use: I.e. you can simply use the name of the variable. Manuel is right, too, that DTML allows much more characters in names than Python does. If you have a name with a character forbidden in Python names, such as e.g. a "-", then you can use "_[name]" or "_.getitem(name)" (as Manuel said). It is only, that "_" (unlike "-") is allowed in Python names. Dieter ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] sql query results -> DTML method problem
Quoting Lee Reilly CS1997 <[EMAIL PROTECTED]>: > 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 > #2Confirm > #3You entered > #4 > #5 > #6Our records show that is called > #7 > #8 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: the __.() construct is required since underscore arent allowed in python variable names. if the var was called classcode, you could do dats it. > #9 > #10 > #11 > #12 > #13 > #14 > > ^ 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 > I have probs. > > )\"> *** syntax > error > > findClassTitle is a ZSQL method for returning the class title given a > class code: > > select title from classes > where > > Hmm... anyone see the problem? > > Thanks a lot :) > > - Best regards, > > Lee > > ___ > Zope maillist - [EMAIL PROTECTED] > 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 ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] sql query results -> DTML method problem
>#8 you might wanna try either or > *** syntax >error regards. -- pashah ___ Zope maillist - [EMAIL PROTECTED] 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 )
[Zope] sql query results -> DTML method problem
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 #2 Confirm #3 You entered #4 #5 #6 Our records show that is called #7 #8 #9 #10 #11 #12 #13 #14 ^ 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 I have probs. *** syntax error findClassTitle is a ZSQL method for returning the class title given a class code: select title from classes where Hmm... anyone see the problem? Thanks a lot :) - Best regards, Lee ___ Zope maillist - [EMAIL PROTECTED] 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 )