That's an interesting project.

You can use the "yield" command to send partial data to the web-browser, 
but it remains up to the web-browser whether it displays that data right 
then or waits for the rest of the data before rendering the webpage.  If 
you want cross-browser real-time data, your best bet is to run the 
automation task via an external script and write it's output to a file 
incrementally.

Then you can have an AJAX-based page that monitors the output file for 
new content.

I had to do something similar to this for some report generation, but 
the downside is that this is a complex process on a complex mechanism.  
I don't think there is a quick/easy way to do it.

Did that explanation make sense?

-tim

Cro wrote:
> Good day.
> I discovered web2py a few weeks ago. I like it because it's light and
> powerful. :) And the templating system is excellent.
> I played with it a little. I worked in PHP and Karrigell before, so i
> know a little about web servers.
>
> Ok, straight to point.
>
> I use windows. I am trying to make a local server for running some
> automations. (that is, receive raw data from customers, move files
> from one place to another on the server, process data, compress the
> input and output files and send output data to customers. All is done
> automatically, via some batch files / python scripts)
>
> What i want is this : to create some kind of forum, with local area
> network access only, user / password access.
> Then, i want to call the scripts i defined (batch or python) from
> web2py and render in browser the messages that i receive while the
> automation process happens...
>
> I started to broadcast on LAN, port 80. I tested something. On a new
> page i defined :
>
> def index():
>     import os
>     content = "Starting<br>\n"
>
>     os.system('pause')
>
>     content += "The end<br>"
>     return dict( content=XML(content) )
>
> I hope you are not laughing :))
> I checked index page from a client. The page was suspended in client
> browser, and on the server there was one cmd window "Press any key to
> continue". I had to close the cmd window for the page to completely
> load. The other pages were working just fine even when the index page
> was locked, i was very pleased to see that. :)
>
> Now, i cannot work with os.system() calls, because i don't have the
> control i need. I don't know how to catch the messages from the
> program i am running with os.system. I don't need return the codes, i
> want full messages.
> So i used another example :
>
>     import os
>     import subprocess as _sproc
>     from subprocess import PIPE
>     content = "Starting<br>\n"
>
>     p = _sproc.Popen( 'c:web2py/ccc.bat', bufsize=-1, stdout=PIPE,
> stderr=PIPE, shell=True ).communicate()
>     retcode = p[0].replace('\r\n', '<br>\n') + '<br>'
>     content += retcode
>
>     content += "The end<br>"
>     return dict( content=XML(content) )
>
> The file "ccc.bat" contained:
> @ECHO OFF
>
> ECHO AA AAA
> ECHO BB BBB
>
> pause
>
> I was pleased to see that the execution was imediate and the server
> didn't lock. :)
>
> I also tested the same app with a more complex automation. The
> respective page and script freezes completely while the long
> application communicates, but the rest of pages work fine.
>
> I am very happy with web2py.
>
> Can anyone suggest any improvements i can do? Maybe run my
> applications in a different manner, so that the rest of the functions
> included in the script will work while automation communicates?
> Maybe refresh the page with each message printed, so that i don't have
> to wait for the whole process to finish before i can see the
> result?... I don't know how to do that yet.
>
> Thank you.
>
> >
>   

-- 
Timothy Farrell <tfarr...@swgen.com>
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to