James,

On 9/25/06, James Gardner <[EMAIL PROTECTED]> wrote:

Oh I see. My approach to this would just be to have the application log
in a database which files need distributing and have a cron job check
every few minutes if there are any pending files and transfer them as
necessary. That way you decouple the two tasks. You might not be able
to/want to do that with your application though.

I haven't tried any threading from within a Pylons app. Let me know if
it works!

I tried it -- it just works!

I put this in my controller:

    def thread(self):
        file = request.environ['wsgi.errors']
        def write_happy_thoughts_to_log():
            while True:
                file.write("I'm still happy...\n")
                time.sleep(2)
       
        x = threading.Thread(target=write_happy_thoughts_to_log)
        x.start()
       
        return Response('Thread started.')

It just works! You guys rock!

--
Daniel
http://www.storytotell.org -- Tell It!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss
-~----------~----~----~----~------~----~------~--~---

Reply via email to