PageRenderTime 23ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/dynamictable/Schedule.py

http://pyjamas.googlecode.com/
Python | 22 lines | 18 code | 4 blank | 0 comment | 6 complexity | e973e66e494559e1a4adc777fabdb5eb MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. from TimeSlot import TimeSlot
  2. class Schedule:
  3. def __init__(self):
  4. self.timeSlots = []
  5. def addTimeSlot(self, timeSlot):
  6. self.timeSlots.append(timeSlot)
  7. def getDescription(self, daysFilter):
  8. s = None
  9. for timeSlot in self.timeSlots:
  10. if daysFilter[timeSlot.dayOfWeek]:
  11. if not s:
  12. s = timeSlot.getDescription()
  13. else:
  14. s += ", " + timeSlot.getDescription()
  15. if s:
  16. return s
  17. else:
  18. return ""