[twill] question about twill in python

Titus Brown titus at caltech.edu
Tue Mar 14 23:00:20 PST 2006

On Tue, Mar 14, 2006 at 09:40:32PM -0600, James Middendorff wrote:
-> Hello,
-> I am trying to write an app using twill in python, I am gathering variables
-> in my python script and want to use those variables with twill to enter into
-> a form, but I cannot figure out how to use those variables with the fv
-> command? Can you please shed some light on this for me? Thanks

hi, James,

if you want to use Python variables with the Python interface, then you
can just do 

	twill.commands.fv(formname, fieldname, value)

If you want to communicate values from Python into the twill language,
you can do something like this:

	from twill.namespaces import get_twill_glocals()
	global_dict, local_dict = get_twill_glocals()

	global_dict['varname'] = value

'varname' will then be available to 'fv' in a twill script:

	>> fv 1 field $varname

I'll put this into the docs; thanks for reminding me!


More information about the twill mailing list