/pyjs/tests/test019.py

http://pyjamas.googlecode.com/ · Python · 20 lines · 17 code · 3 blank · 0 comment · 6 complexity · c6ccffc5c6ee341040743dcbfb791107 MD5 · raw file

  1. class Schedule:
  2. def __init__(self):
  3. self.timeSlots = []
  4. def addTimeSlot(self, timeSlot):
  5. self.timeSlots.append(timeSlot)
  6. def getDescription(self, daysFilter):
  7. s = None
  8. for timeSlot in self.timeSlots:
  9. if daysFilter[timeSlot.dayOfWeek]:
  10. if not s:
  11. s = timeSlot.getDescription()
  12. else:
  13. s += ", " + timeSlot.getDescription()
  14. if s:
  15. return s
  16. else:
  17. return ""