6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-04 20:37:52 +00:00

Fix parsing of weird characters in configuration parameters

This commit is contained in:
Régis Behmo 2019-07-11 10:31:23 +08:00
parent ae23637d76
commit d4a429bcc5
2 changed files with 5 additions and 1 deletions

View File

@ -22,3 +22,6 @@ class SerializeTests(unittest.TestCase):
def test_parse_list(self): def test_parse_list(self):
self.assertEqual(["abcd"], serialize.parse('["abcd"]')) self.assertEqual(["abcd"], serialize.parse('["abcd"]'))
def test_parse_weird_chars(self):
self.assertEqual("*@google.com", serialize.parse("*@google.com"))

View File

@ -1,5 +1,6 @@
import yaml import yaml
from yaml.parser import ParserError from yaml.parser import ParserError
from yaml.scanner import ScannerError
def load(stream): def load(stream):
@ -16,6 +17,6 @@ def parse(v):
""" """
try: try:
return load(v) return load(v)
except ParserError: except (ParserError, ScannerError):
pass pass
return v return v