<commit_before>"""Portal view functions (i.e. not part of the API or auth)"""
import requests
from lxml import etree
from flask import current_app, Blueprint, jsonify, render_template
from flask import abort, redirect, request, session, url_for
from flask_login import login_user
from flask_user import roles_required
from flask_swagger import swagger

from ..audit import auditable_event
from .crossdomain import crossdomain
from ..models.coredata import Coredata
from ..models.identifier import Identifier
from ..models.intervention import INTERVENTION
from ..models.message import EmailMessage
from ..models.organization import OrganizationIdentifier
from ..models.role import ROLE
from ..models.user import add_anon_user, current_user, get_user, User
from ..extensions import db, oauth
from ..system_uri import SHORTCUT_ALIAS
from ..tasks import add, post_request

portal = Blueprint('portal', __name__)


def page_not_found(e):
    return render_template('error.html', no_nav="true"), 404

def server_error(e):  # pragma: no cover<commit_msg>more liferay xml cdata parsing issues - removing import lxml.etree<commit_after>"""Portal view functions (i.e. not part of the API or auth)"""
import requests
#from lxml import etree
from flask import current_app, Blueprint, jsonify, render_template
from flask import abort, redirect, request, session, url_for
from flask_login import login_user
from flask_user import roles_required
from flask_swagger import swagger

from ..audit import auditable_event
from .crossdomain import crossdomain
from ..models.coredata import Coredata
from ..models.identifier import Identifier
from ..models.intervention import INTERVENTION
from ..models.message import EmailMessage
from ..models.organization import OrganizationIdentifier
from ..models.role import ROLE
from ..models.user import add_anon_user, current_user, get_user, User
from ..extensions import db, oauth
from ..system_uri import SHORTCUT_ALIAS
from ..tasks import add, post_request

portal = Blueprint('portal', __name__)


def page_not_found(e):
    return render_template('error.html', no_nav="true"), 404

def server_error(e):  # pragma: no cover
{'fraction_non_alphanumeric': 0.07495344506517691, 'fraction_numerical': 0.002793296089385475, 'mean_word_length': 5.673913043478261, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '79534', 'n_tokens_mistral': 613, 'n_tokens_neox': 593, 'n_words': 229}