[twill] Hacked some new commands

Titus Brown titus at caltech.edu
Tue Dec 6 11:04:43 PST 2005

Hi, Suresh,

sorry it took me so long to get to this -- I wanted to have the time to
think about how best to deal with it.  Plus, I'm afraid of regular
expressions, so it took me a while to dig into the code!

I spent some time going over your code.  I made a few fairly simple

 * docstrings and >> command now match in variable name usage;

 * re.findall only takes two arguments in Python 2.3, so I switched to
 	using re.compile first, and then using findall with the compiled

 * I don't think __match__ should ever be anything other than a string.
   So, I switched __match__ to __matchlist__ where appropriate.

I checked the code in as an extension, under 'twill.extensions', with
the name 'match_parse'.  Here's an example script:

extend_with match_parse
go http://www.idyll.org/

split "org"
echo __matchlist__

findall "t."
echo __matchlist__

split "org"
popmatch 0
getmatch test 'm[0].split()'
showvar test

split "org"
setmatch "m.split()[0]"

popmatch 0
echo __matchlist__
echo __match__

Before the next non-developer release, I'd like to put in links from the
README documentation and unit tests for the code, but that's about it.
Let me know if you have any updates etc. for the code, too.

In general, I think this type of extension is a good compromise between
adding too many specialized commands into the default twill commands,
yet making these commands part of the standard package.  Comments

The latest egg (for dev version 0.8.1a5) contains this functionality and
is available under



More information about the twill mailing list