class CalendarProvider: def __init__(self, owner): self.owner = owner self.calService = SchoolCalendarService() self.lastStartRow = -1 self.lastMaxRows = -1 self.lastPeople = [] def updateRowData(self, startRow, maxRows, acceptor): if startRow == self.lastStartRow: if maxRows == self.lastMaxRows: self.pushResults(acceptor, startRow, self.lastPeople) return handler = CalendarProviderHandler(self, acceptor, startRow, maxRows) self.calService.getPeople(startRow, maxRows, handler) def pushResults(self, acceptor, startRow, people): rows = [] for person in people: rows.append([ person.getName(), person.getDescription(), person.getSchedule(self.owner.daysFilter) ]) acceptor.accept(startRow, rows)
class CalendarProvider: def __init__(self, owner): self.owner = owner self.calService = SchoolCalendarService() self.lastStartRow = -1 self.lastMaxRows = -1 self.lastPeople = [] def updateRowData(self, startRow, maxRows, acceptor): if startRow == self.lastStartRow: if maxRows == self.lastMaxRows: self.pushResults(acceptor, startRow, self.lastPeople) return self.calService.getPeople(startRow, maxRows, CalendarProviderHandler(self, acceptor, startRow, maxRows)) def pushResults(self, acceptor, startRow, people): rows = [] for person in people: rows.append([person.getName(), person.getDescription(), person.getSchedule(self.owner.daysFilter)]) acceptor.accept(startRow, rows)
def __init__(self, owner): self.owner = owner self.calService = SchoolCalendarService() self.lastStartRow = -1 self.lastMaxRows = -1 self.lastPeople = []