Example #1
0
 def __init__(self, xml):
     self.xmldoc = xml[0]
     self.parsed = False
     self.__priority = None
     self.__status = None
     self.__delivery = None
     self.__goal = None
     self.__assignee = user(None)
     self.__drafter = user(None)
     self.__approver = user(None)
     self.__sprints = set()
Example #2
0
 def __init__(self, xml):
     self.xmldoc = xml[0]
     self.parsed = False
     
     self.registrant = user(None)
     self.date_registered = None
     
     self.starter = user(None)
     self.date_started = None
     
     self.completer = user(None)
     self.date_completed = None
Example #3
0
    def __init__(self, value_dict={}):
    
                #(self, affects, status, importance, assignee, current,
                    #editurl, type, milestone, available_milestone,
                    #lock_importance, targeted_to, remote, editlock,
                    #edit_fields, connection):
        self._connection = value_dict.get("connection", None)
        self._editlock = value_dict.get("editlock", True)
        self._edit_fields = value_dict.get("edit_fields", set())
        self._lock_importance = value_dict.get("lock_importance", False)
        self._target = None
        self._affects = value_dict.get("affects", product(None))
        temp = self._affects.split(" ")
        #FIXME: does not work .sourcepackage is not None, maybe needs .lower()
        if temp[0] == "Ubuntu":
            self._sourcepackage = None
        else:
            self._sourcepackage = temp[0]
        r = re.match(r'^.*\((.*)\)$', self._affects.longname)
        if r:
            self._target = r.group(1).lower()
        self._status = value_dict.get("status", None)
        self._importance = value_dict.get("importance", None)
        self._assignee = value_dict.get("assignee", user(None))
        self._current = value_dict.get("current", None)
        self._editurl = value_dict.get("editurl", None)
        self._type = value_dict.get("type", None)
        self._milestone = value_dict.get("milestone", None)
        self._available_milestone = value_dict.get("available_milestone", {})
        self._targeted_to = value_dict.get("targeted_to", None)
        self._remote = value_dict.get("remote", None)
        
        #"date-created", "date-confirmed", "date-assigned", "date-inprogress", "date-closed"
        self._date_created = value_dict.get("date-created", None)
        self._date_confirmed = value_dict.get("date-confirmed", None)
        self._date_assigned = value_dict.get("date-assigned", None)
        self._date_inprogress = value_dict.get("date-inprogress", None)
        self._date_closed = value_dict.get("date-closed", None)
        self._date_left_new = value_dict.get("date-left-new", None)
        self._date_incomplete = value_dict.get("date-incomplete", None)
        self._date_triaged = value_dict.get("date-triaged", None)
        self._date_fix_committed = value_dict.get("date-fix-committed", None)
        self._date_fix_released = value_dict.get("date-fix-released", None)
        
        #user==reporter
        self._user = value_dict.get("reporter", user(None))
        
        #"component"
        self._component = value_dict.get("component", None)

        self._cache = {}        
Example #4
0
 def _parse():
     if not xmldoc.xpathEval('//table[@id="milestone_specs"]'):
         xmldoc.freeDoc()
         return
         
     blueprinttable = xmldoc.xpathEval('//table[@id="milestone_specs"]//tbody//tr')
     for row in blueprinttable:
         m = row.xpathEval('td[1]//a')
         assert m
         url = m[0].prop("href")
         title = m[0].prop("title")
         spec = m[0].content
         
         m = row.xpathEval('td[2]//span[not(@class="sortkey")]')
         assert m
         priority = m[0].prop("class")
         
         # is the mentorship-icon used?
         mentorship = bool(row.xpathEval('td[2]//img[@alt="mentoring"]'))
         #add INFORMATIONAL
         
         m = row.xpathEval('td[3]/a')
         if m:
             assignee = user.parse_html_user(m[0])
         else:
             assignee = user(None)
         
         m = row.xpathEval('td[4]//span[not(@class="sortkey")]')
         assert m
         delivery = m[0].prop("class")
         
         yield BPInfo(priority, spec, title, url, None, delivery, assignee, None, mentorship)
Example #5
0
def _get_user(xml, path):
    m = xml.xpathEval(path)
    if m:
        return user.parse_html_user(m[0])
    else:
        m = xml.xpathEval("td")
        assert m
        assert "None" in m[0].content
        # in this case this attribute is set to 'None'
        return user(None)
Example #6
0
 def remove(self, lp_user, key=None):
     if key is None or key == self.__default:
         key = self.__default
     else:
         raise NotImplementedError, "It is impossible to unsubscribe from '%s'" %key
     if not isinstance(lp_user, user):
         lp_user = user(lp_user)
     if lp_user in self[key]:
         if lp_user in self.__added:
             self.__added.remove(lp_user)
         else:
             self.__removed.add(lp_user)
         self[key].remove(lp_user)
     else:
         raise ValueError, "'%s' is not directly subscribed to this bug, can not be removed" %lp_user
Example #7
0
 def add(self, lp_user, key=None):
     if key is None or key == self.__default:
         key = self.__default
     else:
         raise NotImplementedError, "It is impossible to subscribe to '%s'" %key
     if not isinstance(lp_user, user):
         lp_user = user(lp_user)
     if not lp_user in self[key]:
         if lp_user in self.__removed:
             self.__removed.remove(lp_user)
         else:
             self.__added.add(lp_user)
         self.__added.add(lp_user)
         self[key].add(lp_user)
     else:
         raise ValueError, "'%s' is already subscribed to this bug" %lp_user
Example #8
0
 def _parse():
     if not xmldoc.xpathEval('//table[@id="speclisting"]'):
         xmldoc.freeDoc()
         return
         
     blueprinttable = xmldoc.xpathEval('//table[@id="speclisting"]//tbody//tr')
     for row in blueprinttable:
         m = row.xpathEval('td[1]//span[not(@class="sortkey")]')
         assert m
         priority = m[0].prop("class")
         
         m = row.xpathEval('td[2]//a')
         assert m
         url = m[0].prop("href")
         title = m[0].prop("title")
         spec = m[0].content
         
         mentorship = bool(row.xpathEval('td[2]//img[@alt="mentoring"]'))
         #add INFORMATIONAL
         
         m = row.xpathEval('td[3]//span[not(@class="sortkey")]')
         assert m
         status = m[0].prop("class")
         
         m = row.xpathEval('td[4]//span[not(@class="sortkey")]')
         assert m
         delivery = m[0].prop("class")
         
         m = row.xpathEval('td[5]//a')
         if m:
             assignee = user.parse_html_user(m[0])
         else:
             assignee = user(None)
         
         m = row.xpathEval('td[6]//a')
         # on personal blueprint pages this column does not exist
         if m:
             project = Project(m[0].prop("href"), m[0].content)
         else:
             project = None
         
         yield BPInfo(priority, spec, title, url, status, delivery, assignee, project, mentorship)
Example #9
0
 def _parse():
     bug_table_rows = xmldoc.xpathEval('//table[@id="milestone_bugtasks"]//tbody//tr')
     for row in bug_table_rows:
         x = row.xpathEval('td[1]//span/img')
         parse_error(x, "BugPage.parse_html_milestone_bugpage.importance", xml=row, url=debug_url)
         importance = x[0].prop("alt").strip("()").title()
         x = row.xpathEval('td[2]')
         parse_error(x, "BugPage.parse_html_milestone_bugpage.nr", xml=row, url=debug_url)
         nr = x[0].content
         x = row.xpathEval('td[3]/a')
         parse_error(x, "BugPage.parse_html_milestone_bugpage.url", xml=row, url=debug_url)
         url = x[0].prop("href")
         summary = x[0].content
         x = row.xpathEval('td[5]//a')
         if x:
             usr = user.parse_html_user(x[0])
         else:
             usr = user(None)
         x = row.xpathEval('td[6]/span[2]')
         parse_error(x, "BugPage.parse_html_milestone_bugpage.status", xml=row, url=debug_url)
         status = x[0].content
         x = BugInfo(nr, url, status, importance, summary, None, all_tasks)
         x.assignee = usr
         yield x