Exemplo n.º 1
0
    def importXml(self, filename):
        '''
        :param str filename: name of XML file with proposals
        '''
        doc = xml_utility.readValidXmlDoc(filename, 
                                          agup_data.AGUP_MASTER_ROOT_TAG, 
                                          agup_data.AGUP_XML_SCHEMA_FILE,
                                          alt_root_tag=ROOT_TAG, 
                                          alt_schema=XML_SCHEMA_FILE,
                                          )
        root = doc.getroot()
        if root.tag == agup_data.AGUP_MASTER_ROOT_TAG:
            proposals_node = root.find('Proposal_list')
        else:
            proposals_node = root    # pre-agup reviewers file

        db = {}
        self.prop_id_list = []
        self.cycle = root.get('cycle', None) or root.get('period', None) or ''
        for node in proposals_node.findall('Proposal'):
            prop_id = xml_utility.getXmlText(node, 'proposal_id')
            prop = proposal.AGUP_Proposal_Data(node, filename)
            db[prop_id] = prop
            self.prop_id_list.append(prop_id)
        self.prop_id_list = sorted(self.prop_id_list)
        self.proposals = db
Exemplo n.º 2
0
    def importXml(self, proposal_node):
        '''
        Fill the class variables with values from the XML node
        
        :param proposal_node: lxml node of the Proposal
        '''
        for key in self.tagList:
            text = xml_utility.getXmlText(proposal_node, key)
            if text is None:
                self.db[key] = None
            else:
                self.db[key] = tools.text_encode(text)
        subject_node = proposal_node.find('subject')
        if subject_node is not None:
            subjects = [node.text.strip() for node in subject_node.findall('name')]
        else:
            subjects = ''
        self.db['subjects'] = ", ".join(subjects)

        # get list of eligible reviewers (specified by full name)
        eligibles = self.eligible_reviewers

        # search for any existing reviewer assignments
        node = proposal_node.find('reviewer')
        for name in node.findall('name'):
            who = name.text.strip()
            assignment = name.get('assigned', None)
            if assignment is not None:
                assignment = int(assignment[-1])
            excluded = name.get('excluded', 'false') == 'true'
            if who not in eligibles and not excluded:
                eligibles[who] = assignment

        # search for any existing topic strength assessments
        self.topics.importXmlTopics(proposal_node, True)
Exemplo n.º 3
0
    def importXml(self, filename):
        '''
        :param str filename: name of XML file with email template and keywords
        '''
        doc = xml_utility.readValidXmlDoc(filename,
                                          agup_data.AGUP_MASTER_ROOT_TAG,
                                          agup_data.AGUP_XML_SCHEMA_FILE)

        root = doc.getroot()
        email_node = root.find('notification_email')
        if email_node is not None:
            text = xml_utility.getXmlText(email_node, 'email_template')
            self.email_template = text or self.email_template
            self.keyword_dict = {}
            for node in email_node.findall('Key'):
                k = node.attrib['name']
                v = node.text.strip()
                self.keyword_dict[k] = v
Exemplo n.º 4
0
 def importXml(self, reviewer):
     '''
     Fill the class variables with values from the XML node
     
     :param reviewer: lxml node node of the Reviewer
     '''
     self.db['name'] = reviewer.attrib['name'].strip()
     for k in self.tagList:
         text = xml_utility.getXmlText(reviewer, k)
         if text is None:
             self.db[k] = None
         else:
             self.db[k] = tools.text_encode(text)
     self.topics = topics.Topics()
     node = reviewer.find('Topics')
     if node is not None:
         for t_node in node.findall('Topic'):
             key = t_node.attrib['name']
             try:
                 value = float( t_node.attrib['value'])
             except ValueError:
                 value = 0.0
             self.topics.add(key, value)
Exemplo n.º 5
0
 def importXml(self, reviewer):
     '''
     Fill the class variables with values from the XML node
     
     :param reviewer: lxml node node of the Reviewer
     '''
     self.db['name'] = reviewer.attrib['name'].strip()
     for k in self.tagList:
         text = xml_utility.getXmlText(reviewer, k)
         if text is None:
             self.db[k] = None
         else:
             self.db[k] = tools.text_encode(text)
     self.topics = topics.Topics()
     node = reviewer.find('Topics')
     if node is not None:
         for t_node in node.findall('Topic'):
             key = t_node.attrib['name']
             try:
                 value = float( t_node.attrib['value'])
             except ValueError:
                 value = 0.0
             self.topics.add(key, value)
Exemplo n.º 6
0
    def importXml(self, proposal_node):
        '''
        Fill the class variables with values from the XML node
        
        :param proposal_node: lxml node of the Proposal
        '''
        for key in self.tagList:
            text = xml_utility.getXmlText(proposal_node, key)
            if text is None:
                self.db[key] = None
            else:
                self.db[key] = tools.text_encode(text)
        subject_node = proposal_node.find('subject')
        if subject_node is not None:
            subjects = [
                node.text.strip() for node in subject_node.findall('name')
            ]
        else:
            subjects = ''
        self.db['subjects'] = ", ".join(subjects)

        # get list of eligible reviewers (specified by full name)
        eligibles = self.eligible_reviewers

        # search for any existing reviewer assignments
        node = proposal_node.find('reviewer')
        for name in node.findall('name'):
            who = name.text.strip()
            assignment = name.get('assigned', None)
            if assignment is not None:
                assignment = int(assignment[-1])
            excluded = name.get('excluded', 'false') == 'true'
            if who not in eligibles and not excluded:
                eligibles[who] = assignment

        # search for any existing topic strength assessments
        self.topics.importXmlTopics(proposal_node, True)