def _loadSchedules(self, element, context): for child in element: tag = XMLIntf.checkAndStripNamespace(child, XMLIntf.importNamespace, context) if tag is None: continue if tag != "schedule-reference": context.log( "Found invalid node in schedule.schedules. Skipping.") continue try: id = int(child.get(u"id")) except: context.log( "Schedule references in schedule.schedules must consist only of <schedule id=\"id\" />" ) continue schedule = self.store.get(Schedule, id) if schedule is not None: if schedule.Parent is not None: context.log( "Schedule %d is already assigned to another parent." % (schedule.ID)) continue if not Schedule.checkNestable(self.ScheduleKind, schedule.ScheduleKind): context.log( "Cannot nest a \"%s\" schedule into a \"%s\" schedule." % (self.ScheduleKind, schedule.ScheduleKind)) continue schedule.Parent = self
def _broadcastsFromDom(self, element, context): for child in element: tag = XMLIntf.checkAndStripNamespace(element, context=context) if tag is None: continue if tag == u"broadcast": broadcast = context.importFromETree(child, Broadcast) if broadcast is None: continue if broadcast.Station != self and broadcast.ScheduleLeaf is not None and broadcast.ScheduleLeaf.Station != self: context.log("Cannot reassign a broadcast which is bound to a schedule leaf which is not assigned to target station.") else: broadcast.Station = self
def _loadLeaves(self, element, context): for leaf in list(self.Leaves): leaf.delete() for child in element: tag = XMLIntf.checkAndStripNamespace(child, XMLIntf.importNamespace, context) if tag is None: continue if tag != u"leaf": context.log("Found invalid node in schedule.leaves. Skipping.") continue leaf = ScheduleLeaf() self.store.add(leaf) leaf.Schedule = self leaf.fromDom(child)
def _loadSchedules(self, element, context): for child in element: tag = XMLIntf.checkAndStripNamespace(child, XMLIntf.importNamespace, context) if tag is None: continue if tag != "schedule-reference": context.log("Found invalid node in schedule.schedules. Skipping.") continue try: id = int(child.get(u"id")) except: context.log("Schedule references in schedule.schedules must consist only of <schedule id=\"id\" />") continue schedule = self.store.get(Schedule, id) if schedule is not None: if schedule.Parent is not None: context.log("Schedule %d is already assigned to another parent." % (schedule.ID)) continue if not Schedule.checkNestable(self.ScheduleKind, schedule.ScheduleKind): context.log("Cannot nest a \"%s\" schedule into a \"%s\" schedule." % (self.ScheduleKind, schedule.ScheduleKind)) continue schedule.Parent = self