Rename morss/cgi.py into morss/wsgi.py

To avoid name collision with the built-in cgi lib
master
pictuga 2020-08-23 18:44:49 +02:00
parent 4dfebe78f7
commit 47a17614ef
4 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
from morss.__main__ import main
from morss.cgi import application
from morss.wsgi import application
if __name__ == '__main__':
main()

View File

@ -1,3 +1,3 @@
# ran on `import morss`
from .morss import *
from .cgi import application
from .wsgi import application

View File

@ -3,7 +3,7 @@
import os
import sys
from . import cgi
from . import wsgi
from . import cli
from .morss import MorssException
@ -28,10 +28,10 @@ def main():
if 'REQUEST_URI' in os.environ:
# mod_cgi
app = cgi.cgi_app
app = cgi.cgi_dispatcher(app)
app = cgi.cgi_error_handler(app)
app = cgi.cgi_encode(app)
app = wsgi.cgi_app
app = wsgi.cgi_dispatcher(app)
app = wsgi.cgi_error_handler(app)
app = wsgi.cgi_encode(app)
wsgiref.handlers.CGIHandler().run(app)
@ -49,11 +49,11 @@ def main():
else:
port = PORT
app = cgi.cgi_app
app = cgi.cgi_file_handler(app)
app = cgi.cgi_dispatcher(app)
app = cgi.cgi_error_handler(app)
app = cgi.cgi_encode(app)
app = wsgi.cgi_app
app = wsgi.cgi_file_handler(app)
app = wsgi.cgi_dispatcher(app)
app = wsgi.cgi_error_handler(app)
app = wsgi.cgi_encode(app)
print('Serving http://localhost:%s/' % port)
httpd = wsgiref.simple_server.make_server('', port, app)