comparison src/memory/memory.py @ 2052:d44efd32bc2f

core: line feed (\n) are now forbidden in profile names
author Goffi <goffi@goffi.org>
date Sun, 28 Aug 2016 20:09:09 +0200
parents b536dd121da1
children 1d3f73e065e1
comparison
equal deleted inserted replaced
2051:1dc3c7680ea0 2052:d44efd32bc2f
459 @param password (unicode): profile password 459 @param password (unicode): profile password
460 Can be empty to disable password 460 Can be empty to disable password
461 @return: Deferred 461 @return: Deferred
462 """ 462 """
463 if not name: 463 if not name:
464 raise ValueError("Empty profile name") 464 raise ValueError(u"Empty profile name")
465 if name[0] == '@': 465 if name[0] == '@':
466 raise ValueError("A profile name can't start with a '@'") 466 raise ValueError(u"A profile name can't start with a '@'")
467 if '\n' in name:
468 raise ValueError(u"A profile name can't contain line feed ('\\n')")
467 469
468 if name in self._entities_cache: 470 if name in self._entities_cache:
469 raise exceptions.ConflictError(u"A session for this profile exists") 471 raise exceptions.ConflictError(u"A session for this profile exists")
470 472
471 d = self.params.asyncCreateProfile(name) 473 d = self.params.asyncCreateProfile(name)