def verify_changes(self, id_num, title, description): new_mysql_handler = mysql_handler() stored_data = new_mysql_handler.verify_issue(id_num) if not (str(stored_data[0]) == title and str(stored_data[1]) == description): new_mysql_handler.update_issue(id_num, title, description) return True else: return False
def POST(self): new_config = config() self.forward_url = new_config.custom_url self.events_list = new_config.events_list content_result = self.check_content_type() if(content_result): print "Content-Type: text/html" print self.data = web.data() #Check if the event is an issue, otherwise forward the payload to the custom url if self.github_event == "issues": json_data = json.loads(self.data) if json_data['action'] == "opened" or json_data['action'] == "reopened": #Add new issue to database json_data = json_data['issue'] issue_id = json_data['id'] issue_title = json_data['title'] issue_description = json_data['body'] new_mysql_handler = mysql_handler() new_mysql_handler.add_new_issue(issue_id, issue_title, issue_description) elif json_data['action'] == "closed": #As the issue is closed we can delete it from the table json_data = json_data['issue'] issue_id = json_data['id'] new_mysql_handler = mysql_handler() new_mysql_handler.close_issue(issue_id) #Forward issue self.forward_hook() elif self.github_event in self.events_list: self.forward_hook() else: print "Content-Type: text/html" print print "Nothing to see here" print