I would use a background process that does the work and adds the items to a database table. The index function would periodically refresh or pull an updated list via ajax from the database table. there is no way for te server to trigger an action in the browser unless 1) the browser initiates it or 2) the client code embeds an ajax http server. I would stay away from 1 and 2 and use reload of ajax.
On May 25, 5:33 pm, Giuseppe Luca Scrofani <glsdes...@gmail.com> wrote: > Hi all, as promised I'm here to prove you are patient and nice :) > I' have to make this little app where there is a function that read > the html content of several pages of another website (like a spider) > and if a specified keyword is found the app refresh a page where there > is the growing list of "match". > Now, the spider part is already coded, is called search(), it uses > twill to log in the target site, read the html of a list of pages, > perform some searching procedures and keep adding the result to a > list. I integrated this in a default.py controller and make a call in > def index(): > This make the index.html page loading for a long time, because now it > have to finish to scan all pages before return all results. > What I want to achieve is to automatically refresh index every 2 > second to keep in touch with what is going on, seeing the list of > match growing in "realtime". Even better, if I can use some sort of > ajax magic to not refresh the entire page... but this is not vital, a > simple page refresh would be sufficient. > Question is: I have to use threading to solve this problem? > Alternative solutions? > I have to made the list of match a global to read it from another > function? It would be simpler if I made it write a text file, adding a > line for every match and reading it from the index controller? If I > have to use thread it will run on GAE? > > Sorry for the long text and for my bad english :) > > gls