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
Pipeline #22439 passed with stage
in 0 seconds
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import cgi
import csv import csv
import datetime import datetime
import json import json
...@@ -19,6 +18,11 @@ from six.moves.urllib.request import urlopen ...@@ -19,6 +18,11 @@ from six.moves.urllib.request import urlopen
from six.moves.urllib.parse import urlparse from six.moves.urllib.parse import urlparse
import uuid 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): def createStatusItem(item_directory, instance_name, callback, date, link, status):
global app global app
callback_short_name = os.path.basename(callback) callback_short_name = os.path.basename(callback)
...@@ -97,7 +101,7 @@ def main(): ...@@ -97,7 +101,7 @@ def main():
content = ("OK</br><p>%s ran successfully</p>" content = ("OK</br><p>%s ran successfully</p>"
"<p>Output is: </p><pre>%s</pre>" % ( "<p>Output is: </p><pre>%s</pre>" % (
args.executable[0], args.executable[0],
cgi.escape(content) escape(content)
)) ))
saveStatus('FINISHED') saveStatus('FINISHED')
break break
...@@ -110,7 +114,7 @@ def main(): ...@@ -110,7 +114,7 @@ def main():
"<p>Output is: </p><pre>%s</pre>" % ( "<p>Output is: </p><pre>%s</pre>" % (
args.executable[0], args.executable[0],
exit_code, exit_code,
cgi.escape(content) escape(content)
)) ))
print(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