def execute(my): # get command sobject and the notification code associated with it class_name = my.get_command().__class__.__name__ cmd_sobj = CommandSObj.get_by_class_name(class_name) # if this command is not registered, it cannot have a notification # code, so skip if not cmd_sobj: return my.notification_code = cmd_sobj.get_value('notification_code') # get the search objects operated on by the command and iterate # through them command = my.get_command() sobjects = command.get_sobjects() if not sobjects: msg = "Command [%s] has no sobjects. Triggers cannot be called" % class_name Environment.add_warning("Command has no sobjects", msg) input = my.get_input() # TODO: figure out what to do when there are multiple sobjects # Right now, there is a single mail per sobject which may be # way too heavy. for sobject in sobjects: my.handle_sobject(sobject, command, input)
def execute(my): # get command sobject and the notification code associated with it class_name = my.get_command().__class__.__name__ cmd_sobj = CommandSObj.get_by_class_name(class_name) if not cmd_sobj: return my.notification_code = cmd_sobj.get_value('notification_code') # get the search objects operated on by the command and iterate # through them command = my.get_command() sobjects = command.get_sobjects() if not sobjects: msg = "Command '%s' has no sobjects. Triggers cannot be called" % class_name Environment.add_warning("Command has no sobjects", msg) for sobject in sobjects: my.handle_sobject(sobject, command)
def execute(self): # get command sobject and the notification code associated with it class_name = self.get_command().__class__.__name__ cmd_sobj = CommandSObj.get_by_class_name(class_name) if class_name != 'SimpleStatusCmd': return if not cmd_sobj: return # get the search objects operated on by the command and iterate # through them command = self.get_command() sobjects = command.get_sobjects() if not sobjects: msg = "Command '%s' has no sobjects. Triggers cannot be called" % class_name Environment.add_warning("Command has no sobjects", msg) for sobject in sobjects: self.handle_sobject(sobject, command)