Commit 65155b45 authored by Thomas Leymonerie's avatar Thomas Leymonerie Committed by Thomas Gambier

slapos/pusub/notifier.py: Add support for Python 3.8+

parent 4be746d2
......@@ -3,7 +3,6 @@
from __future__ import print_function
import argparse
import cgi
import csv
import datetime
import json
......@@ -19,6 +18,11 @@ from six.moves.urllib.request import urlopen
from six.moves.urllib.parse import urlparse
import uuid
if sys.version_info[:2] >= (3,8):
from html import escape
else:
from cgi import escape
def createStatusItem(item_directory, instance_name, callback, date, link, status):
global app
callback_short_name = os.path.basename(callback)
......@@ -97,7 +101,7 @@ def main():
content = ("OK</br><p>%s ran successfully</p>"
"<p>Output is: </p><pre>%s</pre>" % (
args.executable[0],
cgi.escape(content)
escape(content)
))
saveStatus('FINISHED')
break
......@@ -110,7 +114,7 @@ def main():
"<p>Output is: </p><pre>%s</pre>" % (
args.executable[0],
exit_code,
cgi.escape(content)
escape(content)
))
print(content)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment