def valiate(self, comment): messages = [] annotations = comment.annotations() if 'fixes' in annotations or 'updates' in annotations: if 'fixes' in annotations: gus_id = annotations['fixes'] else: gus_id = annotations['updates'] gus = BacklogClient() try: work = gus.find_work(gus_id) if work['Closed__c'] == 1: messages.append("Work %s is already Closed. This change needs a new work item." % gus_id) except: messages.append("Can't connect to GUS to check work status. Connect to vpn before committing.") return messages
def validate(self, comment): messages = [] annotations = comment.annotations() if 'fixes' in annotations: gus_id = annotations['fixes'] gus = BacklogClient() try: work = gus.find_work(gus_id) status = work['Status__c'] if status != 'In Progress': messages.append("Work %s status is not In Progress, please update GUS before committing" % gus_id) except NoRecordException: messages.append("Invalid GUS id: %s. Please use a valid W# in Gus" % gus_id) GusHelper().show_potential_work(messages) except: messages.append("Can't connect to GUS to check work status. Connect to vpn before committing.") return messages