diff --git a/TM1py/Objects/Cube.py b/TM1py/Objects/Cube.py index ed5335b5..33ffe60f 100644 --- a/TM1py/Objects/Cube.py +++ b/TM1py/Objects/Cube.py @@ -112,7 +112,7 @@ def _construct_body(self) -> str: body_as_dict['Dimensions@odata.bind'] = [format_url("Dimensions('{}')", dimension) for dimension in self.dimensions] - if str(self.rules): + if self.has_rules: body_as_dict['Rules'] = str(self.rules) return json.dumps(body_as_dict, ensure_ascii=False) diff --git a/TM1py/Objects/Rules.py b/TM1py/Objects/Rules.py index 662bd523..7a34ab15 100644 --- a/TM1py/Objects/Rules.py +++ b/TM1py/Objects/Rules.py @@ -92,3 +92,8 @@ def __iter__(self): def __str__(self): return self.text + + def __bool__(self): + if len(self.text): + return True + return False