def get(self, instance, **kwargs): value = LinesField.get(self, instance, **kwargs) or () columns = [] for column in value: try: columns.append(loads(column)) except: # BBB try: columns.append(parseColumn(column)) except: pass return columns
def parseColumns(self, columns): ignore = 1 cols = [] for column in columns: try: # BBB if not isinstance(column, dict): column = parseColumn(column) column['ignore'] = ignore > 1 ignore = max(1, ignore-1) if column.get('colspan', 0): ignore = int(column['colspan']) utility = component.getUtility(IType, column['type']) column['utility'] = utility cols.append(column) except: pass return cols