[twill] [RFC] Use of non-string values with ${} notation

Adam Victor Nazareth Brandizzi brandizzi at gmail.com
Tue Oct 18 07:45:20 PDT 2011


Hello, all!

consider the following twill script:

    run 'value = 123'
    go http://www.google.com
    fv 1 q ${value}
    submit
    code 200

If I run this script, I get this error:

    AT LINE: test.twill:3
    ** UNHANDLED EXCEPTION: cannot concatenate 'str' and 'int' objects

The solution is simple: just call str() on the value:

    fv 1 q ${str(value)}

(I could quote the value when setting it, too, but It is not always
possible or desirable)

However, I get into this situation a lot of times and find it pretty
annoying. I wonder: does anyone here get in this situation too? I have
patched twill to stringify all values; would this change be desirable
for everyone?

Thanks in advance!

-- 
Adam Victor Nazareth Brandizzi
http://brandizzi.googlepages.com/



More information about the twill mailing list