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:
parent
ae23637d76
commit
d4a429bcc5
@ -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"))
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user