author | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-09-29 17:45:25 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-09-29 17:45:25 UTC |
parent | 630f934cd200e39484b6bec1109de6de8204500b |
pyweave.cgi | +9 | -8 |
diff --git a/pyweave.cgi b/pyweave.cgi index 060015d..1d06c71 100755 --- a/pyweave.cgi +++ b/pyweave.cgi @@ -520,12 +520,13 @@ def handle_cmd(): print "It only runs inside a web server." return 1 -if os.environ.has_key('GATEWAY_INTERFACE'): - try: - handle_cgi() - except Exception, e: - error(500, "Unhandled exception") - raise -else: - sys.exit(handle_cmd()) +if __name__ == '__main__': + if os.environ.has_key('GATEWAY_INTERFACE'): + try: + handle_cgi() + except Exception, e: + error(500, "Unhandled exception") + raise + else: + sys.exit(handle_cmd())