<Folder instance at 67f918> ???
I'm having a problem passing in a list (as a string) to a Python method... I am creating a list called 'weights' as follows: <dtml-call "REQUEST.set('weights',[])"> <dtml-in "REQUEST.form.items()"> <dtml-if expr="_['sequence-key'] in ('classcode','tablename', 'practicals', 'tutorials', 'assignments', 'bonus')"> <dtml-else> <dtml-call "weights.append(_['sequence-key'] + 'x' + _['sequence-item'])"> </dtml-if> </dtml-in> When I pass this to a Python method and simply return the value of weights like: <dtml-var expr="obtainResults(_.this, `weights`)"> <Folder instance at 67f918> appears in the page (well, in the HTML source) instead of the actual value of weights. Where am I going wrong? displaying <dtml-var weights> gives me: ['b2x5', 'b1x4', 'p9x2', 'p8x3', 'p5x2', 'p4x3', 'p7x2', 'p6x3', 'p1x2', 'p3x2', 'p2x3'] so that's okay. Can anyone offer me any advice? Thanks very much in advance, Lee
Okay, I rewrote all the code and now it's working fine... but it would be nice to know why <Folder instance at 67f918> came about... Cheers, Lee I wrote:
I'm having a problem passing in a list (as a string) to a Python method...
[Lee Reilly CS] | When I pass this to a Python method and simply return the value of | weights like: | | <dtml-var expr="obtainResults(_.this, `weights`)"> | | <Folder instance at 67f918> appears in the page (well, in the HTML | source) instead of the actual value of weights. | | Where am I going wrong? Could it be done like this?: <dtml-var expr="obtainResults(this(), `weights`)"> Cheers, Morten
When I pass this to a Python method and simply return the value of weights like:
<dtml-var expr="obtainResults(_.this, `weights`)">
<Folder instance at 67f918> appears in the page (well, in the HTML source) instead of the actual value of weights.
It looks like an aquisition problem. You've got a folder with id 'weights' that is getting passed instead of the list named 'weights' in the REQUEST object. Try this: <dtml-var expr="obtainResults(_.this, REQUEST['weights'])"> This will ensure that the right variable named weights is passed to the python method. Kevin Teague http://www.bud.ca
participants (3)
-
Kevin Teague -
Lee Reilly CS1997 -
morten@esol.no