コード例 #1
0
    def createCodeReview(self, req):
        struct = CodeReviewStruct(None)
        struct.Author = util.get_reporter_id(req)
        struct.Status = 'Open for review'
        struct.DateCreate = int(time.time())
        struct.Name = req.args.get('Name')
        struct.Notes = req.args.get('Notes')
        id = struct.save(self.env.get_db_cnx())
        
        # loop here through all the reviewers
        # and create new reviewer structs based on them
        string = req.args.get('ReviewersSelected')
        tokens = string.split('#')
        for token in tokens:
            if token != "":
                struct = ReviewerStruct(None)
                struct.IDReview = id
                struct.Reviewer = token
                struct.Status = 'Not Reviewed'
                struct.Vote = "-1"
                struct.save(self.env.get_db_cnx())

        # loop here through all included files
        # and create new file structs based on them
        files = req.args.get('FilesSelected')
        items = files.split('#')
        for item in items:
            if item != "":
                segment = item.split(',')
                struct = ReviewFileStruct(None)
                struct.IDReview = id
                struct.Path = segment[0]
                struct.Version = segment[1]
                struct.LineStart = segment[2]
                struct.LineEnd = segment[3]
                struct.save(self.env.get_db_cnx())

        return id