:debug completely deprecated in favour of DEBUG=

master
pictuga 2020-08-23 14:33:32 +02:00
parent 6dd40e5cc4
commit f65fb45030
3 changed files with 7 additions and 5 deletions

View File

@ -119,7 +119,7 @@ GNU AGPLv3 code
Further options:
- Change what morss does
- `debug`: to have some feedback from the script execution. Useful for debugging. NB. for cli use, set the environment variable `DEBUG=1`
- Environment variable `DEBUG=`: to have some feedback from the script execution. Useful for debugging. On Apache, can be set via the `SetEnv` instruction
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging)
- `callback=NAME`: for JSONP calls
- `cors`: allow Cross-origin resource sharing (allows XHR calls from other servers)

View File

@ -39,8 +39,11 @@ def cgi_parse_environ(environ):
# get options
if 'REQUEST_URI' in environ:
# when running on Apache
url = environ['REQUEST_URI'][1:]
else:
# when using internal server
url = environ['PATH_INFO'][1:]
if environ['QUERY_STRING']:

View File

@ -39,14 +39,13 @@ class MorssException(Exception):
def log(txt):
if ('DEBUG' in os.environ
or ':debug' in os.environ.get('REQUEST_URI', '')
or ':debug' in os.environ.get('PATH_INFO', '')
):
if 'DEBUG' in os.environ:
if 'REQUEST_URI' in os.environ:
# when running on Apache
open('morss.log', 'a').write("%s\n" % repr(txt))
else:
# when using internal server or cli
print(repr(txt))