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)
def makeText(self): ''' generate the text of the panel ''' tbl = pyRestTable.Table() tbl.labels = ['GUP#', 'reviewer 1', 'reviewer 2', 'excluded reviewer(s)', 'title'] for prop in self.agup.proposals: prop_id = prop.getKey('proposal_id') text = prop.getKey('proposal_title') prop_title = tools.text_encode(text).strip() r1, r2 = prop.getAssignedReviewers() r1 = r1 or '' r2 = r2 or '' excluded = prop.getExcludedReviewers(self.agup.reviewers) tbl.rows.append([prop_id, r1, r2, ', '.join(excluded), prop_title]) return tbl.reST()
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)
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)