def importAllTimetables(self): if not self.shouldImportAllTimetables(): return oldTimetables = ITimetableContainer(self.activeSchoolyear) newTimetables = ITimetableContainer(self.newSchoolyear) chooser = INameChooser(newTimetables) app = ISchoolToolApplication(None) tzname = IApplicationPreferences(app).timezone for schooltt in oldTimetables.values(): newSchooltt = Timetable( self.newSchoolyear.first, self.newSchoolyear.last, title=schooltt.title, timezone=tzname) name = chooser.chooseName(schooltt.__name__, newSchooltt) newTimetables[name] = newSchooltt self.setUpTimetable(newSchooltt, schooltt) if (oldTimetables.default is not None and sameProxiedObjects(oldTimetables.default, schooltt)): newTimetables.default = newSchooltt
def importAllTimetables(self): if not self.shouldImportAllTimetables(): return oldTimetables = ITimetableContainer(self.activeSchoolyear) newTimetables = ITimetableContainer(self.newSchoolyear) chooser = INameChooser(newTimetables) app = ISchoolToolApplication(None) tzname = IApplicationPreferences(app).timezone for schooltt in oldTimetables.values(): newSchooltt = Timetable(self.newSchoolyear.first, self.newSchoolyear.last, title=schooltt.title, timezone=tzname) name = chooser.chooseName(schooltt.__name__, newSchooltt) newTimetables[name] = newSchooltt self.setUpTimetable(newSchooltt, schooltt) if (oldTimetables.default is not None and sameProxiedObjects(oldTimetables.default, schooltt)): newTimetables.default = newSchooltt
def handleApply(self, action): container = ITimetableContainer(self.context) container.default = removeSecurityProxy(self.context) self.ajax_settings['dialog'] = 'close'