diff --git a/attributs.py b/attributs.py index 60424c0..0d12bfe 100644 --- a/attributs.py +++ b/attributs.py @@ -1076,7 +1076,13 @@ class blacklist(Attr): python_type = dict def parse_value(self, blacklist): - bl_debut, bl_fin, bl_type, bl_comm = blacklist.split('$') + if isinstance(blacklist, self.python_type): + if set(blacklist.keys()).issuperset(['debut', 'fin', 'type', 'comm']): + bl_debut, bl_fin, bl_type, bl_comm = (blacklist['debut'], blacklist['fin'], blacklist['type'], blacklist['comm']) + else: + raise ValueError("A blacklist should contain the following keys : 'debut', 'fin', 'type', 'comm'") + else: + bl_debut, bl_fin, bl_type, bl_comm = blacklist.split('$') now = time.time() self.value = { 'debut' : bl_debut if bl_debut == '-' else int (bl_debut), 'fin' : bl_fin if bl_fin == '-' else int(bl_fin),