def writeContent(self): self.db = server.server() err = self.db.Connect() if type(err) == ErrType: self.writeError(err) return #else self.bugzDB = bugzServer.server() err = self.bugzDB.Connect() if type(err) == ErrType: self.writeError(err) self.db.Close() return #else self.pyroServer = pyroServer.server() err = self.pyroServer.Connect() if type(err) == ErrType: self.writeError(err) self.pyroServer.Close() return #else self.realWriteContent() self.db.Close() self.bugzDB.Close() self.pyroServer.Close() return
def old_fetchBugzKeepers(): returnList = [] releaseDB = server.server() bugzDB = bugzServer.server() try: releaseDB.Connect() bugzDB.Connect() except: print "Could not connect to database. Aborting" sys.exit(1) result = queryDB(releaseDB, 'id', 'ReleaseAutomation.release_cycle', 'processed', '"N"') idList = map(lambda x: int(x['id']), result) result = queryDB(releaseDB, 'id', 'ReleaseAutomation.merged', 'release_cycle_id', idList) idList = map(lambda x: int(x['id']), result) result = queryDB(releaseDB, 'bug_id', 'ReleaseAutomation.combined', 'merged_id', idList) idList = map(lambda x: int(x['bug_id']), result) result = queryDB(bugzDB, 'fixed_in', 'bugs', 'bug_id', idList) buildList = map(lambda x: str(x['fixed_in']), result) for build in buildList: if ',' in build: for splitBuild in build.split(','): returnList.append(splitBuild.replace(" ", "")) elif ' ' in build: for splitBuild in build.split(' '): returnList.append(splitBuild.replace(" ", "")) elif build.count("_") > 1 and build[0:3] != "f5_" and build[ 0:5] != 'f2624' and build[0:9] != 's124omap3' and build[ 0:6] != 'fp2624': buildString = build print buildString for i in range(build.count("_")): endindex = buildString.index("_") + 8 returnList.append(buildString[0:endindex]) buildString = buildString[endindex:] else: returnList.append(build.replace(" ", "")) releaseDB.Close() bugzDB.Close() return returnList
def writeContent(self): request_id = self.request().field("i","") request_type = self.request().field("t", "") if not request_id: self.writeError('''Request ID not specified''') return #else if not request_type: self.writeError('''Request Type not specified''') return #else self.db = server.server() err = self.db.Connect() if type(err) == ErrType: self.writeError(err) return #else self.bugzDB = bugzServer.server() err = self.bugzDB.Connect() if type(err) == ErrType: self.writeError(err) self.db.Close() return #else self.pyroServer = pyroServer.server() err = self.pyroServer.Connect() if type(err) == ErrType: self.writeError(err) self.pyroServer.Close() return #else #Get and print fields err = self.getErrataFields(request_id, request_type) if type(err) == ErrType: self.writeError(err) self.db.Close() self.bugzDB.Close() self.pyroServer.Close() return
def writeContent(self): self.db = server.server() self.bugzDB = bugzServer.server() err = self.db.Connect() if type(err) == ErrType: self.writeError(err) return err = self.bugzDB.Connect() if type(err) == ErrType: self.writeError(err) self.db.Close() return self.writeQueue() self.db.Close() self.bugzDB.Close()
def writeContent(self): request_id = self.request().field("i", "") request_type = self.request().field("t", "") if not request_id: self.writeln('''Empty Errata''') return #else self.db = server.server() err = self.db.Connect() if type(err) == ErrType: self.writeError(err) return #else self.bugzDB = bugzServer.server() err = self.bugzDB.Connect() if type(err) == ErrType: self.writeError(err) self.db.Close() return #else self.pyroServer = pyroServer.server() err = self.pyroServer.Connect() if type(err) == ErrType: self.writeError(err) self.pyroServer.Close() #else #Generate errata err = self.generateErrata(request_id, request_type) if type(err) == ErrType: self.writeError(err) self.db.Close() self.bugzDB.Close() self.pyroServer.Close() return
def loginUser(self, username, password): # We mark a user as logged-in by setting a session variable # called authenticated_user to the logged-in username. # Here, you could also pull in additional information about # this user (such as a user ID or user preferences) and store # that information in session variables. login = False if len(password) < 1: return 0 if self.isValidUserAndPassword(username, password): login = True self.bugzDB = bugzServer.server() err = self.bugzDB.Connect() if type(err) == ErrType: return 0 cmd = '''SELECT * FROM profiles WHERE auth_id="%s"'''%(username) result = self.bugzDB.Command(cmd) self.bugzDB.Close() if not result: login = False else: container = result[0] user_id = container['userid'] self.session().setValue('authenticated_user', username) self.session().setValue('authenticated_user_id', user_id) return 1 else: login = False if not login: self.session().setValue('authenticated_user', None) self.session().setValue('authenticated_use_id', None) return 0 return 1
def process(self): #print self.request().fields() # save all contents self.vars['package'] = self.request().field('package') self.vars['bug'] = self.request().field('bug') self.vars['errors'] = None self.vars['priority'] = self.request().field('priority') self.vars['notes'] = self.request().field('notes') self.vars['releaseState'] = False dict = self.vars['type'] for t in dict: if self.request().hasField(t): dict[t] = 1 else: dict[t] = 0 #print self.vars #validate everything submitter_id = self.session().value("authenticated_user_id", None) submitter_user = self.session().value("authenticated_user", None) name = self.vars['package'] bug_number = self.vars['bug'] priority = self.vars['priority'] notes = self.vars['notes'] type_dict = self.vars['type'] type_list = [] for t in type_dict: if self.request().hasField(t): type_list.append(t) #end type_dict if not self.db: self.db = server.server() self.bugzDB = bugzServer.server() self.pyroServer = pyroServer.server() error = self.db.Connect() if type(error) == ErrType: self.vars['errors'] = error self.writeBody() return error = self.bugzDB.Connect() if type(error) == ErrType: self.vars['errors'] = error self.writeBody() return error = self.pyroServer.Connect() if type(error) == ErrType: self.vars['errors'] = error self.wrteBody() return # request = util.request(self.db, self.bugzDB, self.pyroServer) error = request.verify(submitter_id, submitter_user, name, bug_number, \ type_list, priority, notes) if type(error) == ErrType: self.db.Close() self.bugzDB.Close() self.pyroServer.Close() self.vars['errors'] = error self.writeBody() return #Submit Request error = request.submit() self.db.Close() self.bugzDB.Close() self.pyroServer.Close() if type(error) == ErrType: self.vars['errors'] = error self.writeBody() return self.vars['releaseState'] = True self.writeBody() return
#!/usr/bin/env python import bugzServer, sys try: inStr = sys.argv[1] except: print "Maybe you should try inputting something, sheesh." sys.exit(0) mydb = bugzServer.server() mydb.Connect() results = mydb.Command( '''Select bug_id,fixed_in from bugz.bugs WHERE fixed_in LIKE "%%%s%%"''' % inStr) for result in results: print "Bug #: " + str(result['bug_id']) + " fixed_in: " + str( result['fixed_in'])