summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylanx.c.baker@intel.com>2014-12-29 16:25:35 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2015-01-07 11:29:43 -0800
commit72b4ac514d8e155609c03991c7bdea2a5e3f3f2f (patch)
tree2545de20726f9bffacbc7a2721a7c624286cf518
parent8350f471a6a8c27cf155f9afd2d85ffbc871f9f7 (diff)
grouptools.py: Don't allow non-string arguments
Since we want to do string operations on the inputs to the various grouptools modules assert that the inputs are in fact strings not other things. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
-rw-r--r--framework/grouptools.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/framework/grouptools.py b/framework/grouptools.py
index 74b75a335..7a7a12733 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -44,6 +44,7 @@ __all__ = [
def _assert_illegal(group):
"""Helper that checks for illegal characters in input."""
+ assert isinstance(group, (str, unicode)), 'Type must be string or unicode'
assert '\\' not in group, \
'Groups are not paths and cannot contain \\. ({})'.format(group)
assert not group.startswith('/'), \
@@ -103,6 +104,8 @@ def join(*args):
"""
for group in args:
+ assert isinstance(group, (str, unicode)), \
+ 'Type must be string or unicode'
assert '\\' not in group, \
'Groups are not paths and cannot contain \\. ({})'.format(group)
assert not args[0].startswith('/'), \
@@ -149,6 +152,7 @@ def from_path(path):
This safely handles both Windows and Unix style paths.
"""
+ assert isinstance(path, (str, unicode)), 'Type must be string or unicode'
assert not path.startswith('/'), \
'Groups cannot start with /. ({})' .format(path)