On Thu, May 19, 2011 at 1:08 PM, Mark Erbaugh <[email protected]> wrote: > Thanks for the suggestions. I hadn't thought if that way. This is probably > an oddball situation. The application is used to process paperwork for > amateur radio license test sessions. Most oft the time, the test sessions are > small and the paperwork is processed by a single user on a single > workstation. But once in a while, we hold a huge test session and have 6-8 > workstations on a LAN. To save coding, for the single user mode, I just run > the server and a web browser on the same machine. That's the application > where I was thinking of being able to shut down the server via the web > browser.
Ah, ok, that makes it a bit clearer. Well, ok, I'd do it like this (no guarantee it'd work, though, since I haven't used web.py in a while. You can implement the terminate session variable, and when the server detects the last active session was soft-terminated, then it does the hard-terminate using sys.exit()[1]. I'm not sure if that would work, though. I know it doesn't always work. In some environments, the default catch-all mechanism may catch the SystemExit exception that sys.exit() raises and dump a traceback in the browser. You can also force termination by using the os._exit()[2] call. You should test them in this order. sys.exit() allows the system to do some clean-up, whereas the os._exit() just blows the interpreter up into the sky and never looks back. [1] http://docs.python.org/library/sys.html#sys.exit [2] http://docs.python.org/library/os.html#os._exit -- Branko Vukelic -- You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en.
