コード例 #1
0
ファイル: web.py プロジェクト: gitmob/yabbe
    def filter_bugs(self, status, assignee, target, tag):
        """Filter the list of bugs to return only those desired."""
        bugs = [bug for bug in self.bd if bug.status in status]

        if assignee != '':
            assignee = None if assignee == 'None' else assignee
            bugs = [bug for bug in bugs if bug.assigned == assignee]

        if tag != '' and tag != 'None':
            bugs = [bug for bug in bugs
                    if tag in libbe.command.tag.get_tags(bug)]

        if target != '':
            target = None if target == 'None' else target
            if target == None:
                # Return all bugs that don't block any targets.
                return [bug for bug in bugs if not bug_target(self.bd, bug)]
            else:
                # Return all bugs that block the supplied target.
                targetbug = bug_from_target_summary(self.bd, target)
                if targetbug == None:
                    return []
                bugs = [bug for bug in get_blocked_by(self.bd, targetbug) if
                        bug.active]

        return bugs
コード例 #2
0
    def edit(self, id, status=None, target=None, assignee=None, severity=None, summary=None):
        """The view that handles editing bug details."""
        bug = self.bd.bug_from_uuid(id)
        
        if summary != None:
            bug.summary = summary
        else:
            bug.status = status if status != 'None' else None
            bug.assigned = assignee if assignee != 'None' else None
            bug.severity = severity if severity != 'None' else None
            
        if target:
            current_target = bug_target(self.bd, bug)
            if current_target:
                remove_target(self.bd, bug)
                if target != "None":
                    add_target(self.bd, bug, target)
            else:
                add_target(self.bd, bug, target)

        bug.save()

        raise cherrypy.HTTPRedirect(
            '/bug?%s' % urlencode({'id':bug.id.long_user()}),
            status=302)
コード例 #3
0
ファイル: web.py プロジェクト: gitmob/yabbe
    def edit(self, id, status=None, target=None, assignee=None, severity=None, summary=None):
        """The view that handles editing bug details."""
        bug = self.bd.bug_from_uuid(id)

        if summary != None:
            bug.summary = summary
        else:
            bug.status = status if status != 'None' else None
            bug.assigned = assignee if assignee != 'None' else None
            bug.severity = severity if severity != 'None' else None

        if target:
            current_target = bug_target(self.bd, bug)
            if current_target:
                remove_target(self.bd, bug)
                if target != "None":
                    add_target(self.bd, bug, target)
            else:
                add_target(self.bd, bug, target)

        bug.save()

        raise cherrypy.HTTPRedirect(
            '/bug?%s' % urlencode({'id':bug.id.long_user()}),
            status=302)
コード例 #4
0
    def filter_bugs(self, status, assignee, target, tag):
        """Filter the list of bugs to return only those desired."""
        bugs = [bug for bug in self.bd if bug.status in status]

        if assignee != '':
            assignee = None if assignee == 'None' else assignee
            bugs = [bug for bug in bugs if bug.assigned == assignee]

        if tag != '' and tag != 'None':
            bugs = [
                bug for bug in bugs if tag in libbe.command.tag.get_tags(bug)
            ]

        if target != '':
            target = None if target == 'None' else target
            if target == None:
                # Return all bugs that don't block any targets.
                return [bug for bug in bugs if not bug_target(self.bd, bug)]
            else:
                # Return all bugs that block the supplied target.
                targetbug = bug_from_target_summary(self.bd, target)
                if targetbug == None:
                    return []
                bugs = [
                    bug for bug in get_blocked_by(self.bd, targetbug)
                    if bug.active
                ]

        return bugs