class ControllerWithCellInfo(object): content_types = [getattr(ContentType, i) for i in dir(ContentType) if not i.startswith('__') ] cell_types = [getattr(CellType, i) for i in dir(CellType) if not i.startswith('__') ] def __init__(self): self._string = String() def get_cell_info(self, row, column): return CellInfo(CellContent(self._get(self.content_types), self._get_data(), None), CellPosition(self._get(self.cell_types), None)) def _get(self, items): return items[random.randint(0, len(items)-1)] def _get_data(self): if random.randint(0, 5) == 0: return "data with some ${variable} in there" return self._string.generate_random_string(50)
class ControllerWithCellInfo(object): content_types = [ getattr(ContentType, i) for i in dir(ContentType) if not i.startswith('__') ] cell_types = [ getattr(CellType, i) for i in dir(CellType) if not i.startswith('__') ] def __init__(self): self._string = String() def get_cell_info(self, row, column): return CellInfo( CellContent(self._get(self.content_types), self._get_data(), None), CellPosition(self._get(self.cell_types), None)) def _get(self, items): return items[random.randint(0, len(items) - 1)] def _get_data(self): if random.randint(0, 5) == 0: return "data with some ${variable} in there" return self._string.generate_random_string(50)
def __init__(self): self._string = String()