Allow empty strings for raw and default types.

Empty string is a perfectly valid raw string and the default type is
meant to prevent malicious characters, not empty strings.

Change-Id: I717bbcfe1a81b383782122870d0d727b28f40cce
This commit is contained in:
Clint Byrum 2013-05-21 10:07:48 -07:00
parent c56819ae40
commit fa5fb2d163
2 changed files with 10 additions and 2 deletions

View File

@ -35,3 +35,11 @@ class ValueTypeTestCase(testtools.TestCase):
def test_default_bad(self):
self.assertRaises(config_exception.ConfigException,
value_types.ensure_type, "foo\nbar", "default")
def test_default_empty(self):
self.assertEqual('',
value_types.ensure_type('', 'default'))
def test_raw_empty(self):
self.assertEqual('',
value_types.ensure_type('', 'raw'))

View File

@ -19,8 +19,8 @@ from config_exception import ConfigException
TYPES = {
"int": "^[0-9]+$",
"default": "^[A-Za-z0-9]+$",
"raw": "."
"default": "^[A-Za-z0-9]*$",
"raw": ""
}