I'm trying with something like:
twill.set_output(response.render)
without luck by now.

I don't know where to catch the object which render the output to views.

El 23/12/2009 2:43, Alex Fanjul escribió:
> Has somebody got to work with twill+web2py? (Im using Apache + mod_wsgi)
> I'm trying to navigate to some page and show the html in my page 
> (return of my index controller)
>
> I'm trying that, and it's my situation:
>
> 1) Succesful importing module: I installed and used " from twill 
> import * "
> 2) At first attempt it threw me and error: " IOError: sys.stdout 
> access restricted by mod_wsgi "
> 3) I used the trick to redirect stdout (spited from twill command line 
> tool) to stderr: " sys.stdout = sys.stderr "
> 4) Now it shows None in webpage but spite the html form through 
> error.log Apache  (but that isnt what we want to)
> 5) I investigated some deeper and found this -maybe- useful things:
>
> - From Twill Documentation <http://twill.idyll.org/python-api.html>:
>
> /You can capture command output by passing any write-enabled file 
> handle to twill.set_output, e.g.
> twill.set_output(StringIO()) will send all non-error output into a 
> StringIO() object./
>
> Could I use that to redirect to page renderer or a string to return 
> from controller? I'm sorry I'm newby in python
>
> - Another interesting thing I found is a  " wsgi_intercept.py " file 
> in twill, which say
>
> /wsgi_intercept.WSGI_HTTPConnection is a replacement for
> httplib.HTTPConnection that intercepts certain HTTP connections into a
> WSGI application.
> Use 'add_wsgi_intercept' and 'remove_wsgi_intercept' to control this 
> behavior./
>
> I don't know if it is necessary to use Twill with 
> Web2py+Apache+mod_wsgi. In my first attempt it seems that spited out 
> well the html form options to error.log.
>
> So the question is, how to redirect all twill output to page renderer 
> or wsgi handle, or whatever...
> Thanks in advance,
> Alex F
>
>
> El 11/11/2009 23:06, David escribió:
>> Hey guys,
>>
>> I've been studying up on working with scraping/parsing and remote
>> logins for sites that don't have APIs and I came across Twill.
>>
>> Have any of you used it to automate things like login and screen/html
>> parsing?
>>
>> It would be nice to be able to login to a remote site via a model/
>> controller and pull a small clip of html and stick it on a view
>> somewhere.
>>
>> I've got it working nicely on the shell and it seems quite promising
>> but it doesn't readily appear to me how I would use something like
>> this from inside web2py.
>>
>> Are there any examples that I can have a look at while I am still
>> learning about web2py?
>>
>> Thanks in advance!
>>
>> - David
>> --~--~---------~--~----~------------~-------~--~----~
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email [email protected]
>> To unsubscribe from this group, send email 
>> [email protected]
>> For more options, visit this group 
>> athttp://groups.google.com/group/web2py?hl=en
>> -~----------~----~----~----~------~----~------~--~---
>>
>>
>>    
>
> -- 
> Alejandro Fanjul Fdez.
> [email protected]
> www.mhproject.org

-- 
Alejandro Fanjul Fdez.
[email protected]
www.mhproject.org

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to