def __createTrigger(self, formdata): '''Private method to build the trigger node ''' trigger_val = '' dateSpecified = False xml_trigger = policy_lib.triggerType() xml_trigger_action = policy_lib.actionType() # Process the form data according to the type selected if (formdata['trigger']['name'] == self.dateType): # The date is in the wrong format according to XML schema # it should be: secs mins hours day month year trigger_tmp = formdata['trigger']['value'].split("-") trigger_val = "0 0 0 %s %s %s" % (trigger_tmp[2], trigger_tmp[1], trigger_tmp[0]) dateSpecified = True elif (formdata['trigger']['name'] == self.periodicType): trigger_val = "%s %s %s %s %s" %\ (formdata['trigger_period']['minute']['name'], formdata['trigger_period']['hour']['name'], formdata['trigger_period']['day']['name'], formdata['trigger_period']['month']['name'], formdata['trigger_period']['weekday']['name']) dateSpecified = True if (dateSpecified): xml_trigger.time = trigger_val else: xml_trigger_action.valueOf_ = trigger_val xml_trigger.action = xml_trigger_action return xml_trigger
def __createActionType(self, formdata): '''Private method to build the action type node ''' xml_action_type = policy_lib.actionType() # xml_action_type.policyID = formdata[] xml_action_type.valueOf_ = formdata['type']['name'] return xml_action_type
def __create_action_type(self): '''Private method to build the action type node ''' action_key = self.config.get('ACTIONS_SCHEMA', 'type') action_policy_key = self.config.get('ACTIONS_SCHEMA', 'policy_id') xml_action_type = policy_lib.actionType() if len(self.policy[action_policy_key]['name']) > 0: xml_action_type.policyID = self.policy[action_policy_key]['name'] xml_action_type.valueOf_ = self.policy[action_key] return xml_action_type