def _get_questions_file_content(self) -> str: with codecs.open(self.questions_path, "r", "utf-8") as questions_file: file_content = questions_file.read() try: return decryption(file_content.encode()) except (InvalidToken, Error): return file_content return None
def user_preferences(): if request.method == 'GET': if current_user.jira_password is None: return render_template('preferences.html', user=current_user, password = "") else: return render_template('preferences.html', user=current_user, password = decryption(current_user.jira_password)) current_user.name = request.form['name'] current_user.cc_login = request.form['cc_login'] current_user.jira_login = request.form['jira_login'] current_user.jira_password = encryption(request.form['jira_password']) db.session.commit() flash('User successfully updated his preferences') logger.info('User {email} successfully updated preferences.'.format(email=current_user.email)) return redirect(url_for('user_preferences'))
def integrate_all_old(jira_login, enc_jira_password): """ Add comment to all relevant historical JIRA tickets """ jira = JIRA(options={'server': 'https://jira.genesys.com'}, basic_auth=(jira_login, decryption(enc_jira_password))) link_hgweb_static = app.config["HG_PROD"] + "/rev/" reviews = Review.query.filter(Review.status == "MERGED").all() for review in reviews: changeset = review.changesets[0] for token in token_search(changeset.title): try: issue = jira.issue(token) if not comment_added(changeset.sha1, issue.fields.comment.comments): link_hgweb = link_hgweb_static + changeset.sha1 jira_comment(jira, token, changeset.owner, changeset.created_date, 'IWD', changeset.review.target, link_hgweb, changeset.review_id, changeset.title) except JIRAError as e: if e.status_code == 404: print "Issue does not exist (url: {url})".format(url=e.url)
def jira_integrate(changeset, user): """ Add comment to all relevant JIRA tickets """ jira = JIRA(options={'server': 'https://jira.genesys.com'}, basic_auth=(user.jira_login, decryption(user.jira_password))) link_hgweb_static = app.config["HG_PROD"] + "/rev/" for token in token_search(changeset.title): link_hgweb = link_hgweb_static + changeset.sha1 jira_comment(jira, token, changeset.owner, changeset.created_date, 'IWD', changeset.review.target, link_hgweb, changeset.review_id, changeset.title)