def inEventMask(self, eventMsg=None, testHostGroup=True): if eventMsg: utilXbar = getUtility(IAdmUtilEventCrossbar) if utilXbar is not None: origEvent = utilXbar.getEvent(eventMsg.oidEventObject) if origEvent is not None: eventHostGroup = origEvent.hostGroup eventLocation = origEvent.location eventBuilding = origEvent.building eventRoom = origEvent.room # event for special hostgroup? if testHostGroup and \ eventHostGroup is not None and \ len(eventHostGroup) > 0: if not eventHostGroup in self.hostGroups: return False # event for special location if eventLocation is not None and \ len(eventLocation) > 0: if not nodeIsUnder(self.room, eventLocation): return False # event for special building if eventBuilding is not None and \ len(eventBuilding) > 0: if not nodeIsUnder(self.room, eventBuilding): return False # event for special room if eventRoom is not None and \ len(eventRoom) > 0: if self.room != eventRoom: return False return True return False
def ensureRoomAtLocation(event): if event.room is not None and \ event.location is not None and \ not nodeIsUnder(event.room, event.location): raise Invalid( "Room '%s' is not in location '%s'." % \ (oid2dcTitle(event.room), oid2dcTitle(event.location)))
def ensureRoomInBuilding(event): if event.room is not None and \ event.building is not None and \ not nodeIsUnder(event.room, event.building): raise Invalid( "Room '%s' is not in building '%s'." % \ (oid2dcTitle(event.room), oid2dcTitle(event.building)))
def ensureBuildingInLocation(event): if event.building is not None and \ event.location is not None and \ not nodeIsUnder(event.building, event.location): raise Invalid( "Building '%s' is not in location '%s'." % \ (oid2dcTitle(event.building), oid2dcTitle(event.location)))