Skip to content

Commit

Permalink
:add: exception when a wrong type is waited by the Array
Browse files Browse the repository at this point in the history
  • Loading branch information
b3j0f committed Oct 6, 2016
1 parent ba00d08 commit 0e5b6cd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion b3j0f/conf/configurable/core.py
Expand Up @@ -927,7 +927,7 @@ def applyconfiguration(targets, conf=None, *args, **kwargs):
value=Configurable.DEFAULT_DRIVERS
),
Parameter(
name=Configurable.PATHS, ptype=Array(str),
name=Configurable.PATHS, ptype=Array(string_types),
value=Configurable.DEFAULT_PATHS
),
Parameter(
Expand Down
5 changes: 1 addition & 4 deletions b3j0f/conf/driver/base.py
Expand Up @@ -193,11 +193,8 @@ def _getconf(self, rscpath, logger=None, conf=None):
confparam = conf.param(pname=param.name)

if confparam is not None:
svalue = param.svalue

param.update(confparam)
if svalue is not None:
param.svalue = svalue
param.resolve()

category += param

Expand Down
5 changes: 5 additions & 0 deletions b3j0f/conf/model/param.py
Expand Up @@ -151,6 +151,11 @@ def __instancecheck__(self, instance):
result = isinstance(item, self.ptype)

if not result:
raise ParserError(
'Wrong item {0} ({1}) in {2}. {3} expected.'.format(
item, type(item), instance, self.ptype
)
)
break

return result
Expand Down
1 change: 1 addition & 0 deletions changelog.rst
Expand Up @@ -4,6 +4,7 @@ ChangeLog
0.3.21 (2016/10/05)
-------------------

- add an error message when using the Array object with a wrong item type.
- fix default svalue/value for param.

0.3.20 (2016/09/03)
Expand Down

0 comments on commit 0e5b6cd

Please sign in to comment.