core: line feed (\n) are now forbidden in profile names

This commit is contained in:
Goffi 2016-08-28 20:09:09 +02:00
commit 7ad14f2252

View file

@ -461,9 +461,11 @@ class Memory(object):
@return: Deferred
"""
if not name:
raise ValueError("Empty profile name")
raise ValueError(u"Empty profile name")
if name[0] == '@':
raise ValueError("A profile name can't start with a '@'")
raise ValueError(u"A profile name can't start with a '@'")
if '\n' in name:
raise ValueError(u"A profile name can't contain line feed ('\\n')")
if name in self._entities_cache:
raise exceptions.ConflictError(u"A session for this profile exists")