[twill] 'find' etc. returns

Shalabh Chaturvedi shalabh at cafepy.com
Sun Nov 20 17:49:26 PST 2005


On Nov 19, 2005, at 3:29 PM, Titus Brown wrote:

> -> -> Sometimes I want to extract a string from the page (for example 
> a new
> -> -> id generated by the server) and use it in a following get 
> request. I
> -> -> think it would be useful if find() returned the match object. Or 
> is
> -> -> there another way to do what I'm looking for?
> ->
> -> hi, Shalabh,
> ->
> -> several people have requested this; I don't want to put return 
> values in
> -> (makes the semantics of the language too complicated!) but I could
> -> easily do something like have __match__ be set to the last match 
> found.
> -> Dunno why I didn't think of that before...
>
> Implemented; grab
>
> 	http://darcs.idyll.org/~t/projects/twill-latest-2005-11-19.tar.gz
>
> Note that this may not solve your problem; I may have to put in some
> sort of string formatting system so that you can directly construct
> strings with __var__ and $var.  Thoughts on how to do this welcome...
>
>

Cool - that was pretty quick turnaround. This sort of solved my 
problem. I am using Python scripts so I had to do new_local_dict() 
before I called find(). Also I had to use a regex again on the returned 
string because I wanted group(1) and not the entire match. I'm not sure 
what you mean by __var__ - I'm pretty new to twill.

Thanks,
Shalabh




More information about the twill mailing list