Reputation: 623
I am trying to find the equivalent to php's exit command to stop a page from loading. For example I have:
if(isset($_SESSION['username'])){
}
else{
echo 'Your session has expired, please click <a href="https://dev.test.com/">here</a>';
exit;
}
Notice the exit on the else claus..it will stop the rest of the page from loading.
Is there a way to do this in mod_pythong psp <% exit %>
Sys.exit(0) doesn't seem to work because now i get a HTTP 500 error, even though the logs
[Tue Mar 15 15:36:11 2011] [error] [client
10.184.98.38] PythonHandler mod_python.psp: File "/var/www/html/index.psp", line 38, in ?\n sys.exit(0) [Tue Mar 15 15:36:11 2011] [error] [client
10.184.98.38] PythonHandler mod_python.psp: SystemExit: 0
Upvotes: 0
Views: 318
Reputation: 401152
What about something like this, using sys.exit
:
import sys
sys.exit(0)
The number passed to exit being the exit code -- generally, 0 when there is no error.
Upvotes: 1