예제 #1
0
    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
예제 #2
0
 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
예제 #3
0
파일: Schedule.py 프로젝트: priyom/priyomdb
 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)
예제 #4
0
    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)
예제 #5
0
파일: Schedule.py 프로젝트: priyom/priyomdb
 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