from portality.view.account import blueprint as account from portality.view.nav import blueprint as nav from portality.view.media import blueprint as media from portality.view.admin import blueprint as admin from portality.view.graph import blueprint as graph from portality.view.contact import blueprint as contact from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.package import blueprint as package from portality.view.forms import blueprint as forms from portality.view.pagemanager import blueprint as pagemanager from portality.view.feed import blueprint as feed from portality.view.hooks import blueprint as hooks app.register_blueprint(account, url_prefix='/account') app.register_blueprint(nav, url_prefix='/nav') app.register_blueprint(media, url_prefix='/media') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(graph, url_prefix='/graph') app.register_blueprint(contact, url_prefix='/contact') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(package, url_prefix='/package') app.register_blueprint(forms, url_prefix='/forms') app.register_blueprint(hooks, url_prefix='/hooks') app.register_blueprint(feed) app.register_blueprint(pagemanager) @login_manager.user_loader
import json, time, datetime, math, uuid import portality.models as models from portality.core import app, login_manager from portality.view.stream import stream as rawstream from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.account import blueprint as account from portality.view.record import blueprint as record from portality.view.export import blueprint as export from portality.view.imports import blueprint as imports app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(account, url_prefix='/account') app.register_blueprint(record, url_prefix='/record') app.register_blueprint(export, url_prefix='/export') app.register_blueprint(imports, url_prefix='/import') @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out @app.context_processor def set_current_context(): """ Set some template context globals. """
new ones as required too. ''' from flask import request, render_template from flask_login import login_user, current_user import portality.models as models from portality.core import app, login_manager from portality.view.contact import blueprint as contact from portality.view.query import blueprint as query from portality.view.data import blueprint as data from portality.view.explorer import blueprint as explorer from portality.view.map import blueprint as ip_map app.register_blueprint(contact, url_prefix='/contact') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(data, url_prefix='/data') app.register_blueprint(explorer, url_prefix='/explorer') app.register_blueprint(ip_map, url_prefix='/map') @app.route('/index') @app.route('/') def index(): return render_template('index.html') @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid)
''' from flask import request, render_template from flask_login import login_user, current_user import portality.models as models from portality.core import app, login_manager from portality.view.contact import blueprint as contact from portality.view.query import blueprint as query from portality.view.data import blueprint as data from portality.view.explorer import blueprint as explorer from portality.view.map import blueprint as ip_map app.register_blueprint(contact, url_prefix='/contact') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(data, url_prefix='/data') app.register_blueprint(explorer, url_prefix='/explorer') app.register_blueprint(ip_map, url_prefix='/map') @app.route('/index') @app.route('/') def index(): return render_template('index.html') @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out
from flask import Flask, request, abort, render_template, redirect, make_response, jsonify, send_file, \ send_from_directory from flask.views import View import portality.models as models from portality.core import app from portality import settings from portality.view.query import blueprint as query app.register_blueprint(query, url_prefix='/user_query') @app.route("/") def root(): return render_template("app/search.html") @app.errorhandler(404) def page_not_found(e): return render_template('errors/404.html'), 404 if __name__ == "__main__": app.run(host=app.config.get("HOST", "0.0.0.0"), debug=app.config['DEBUG'], port=app.config['PORT'])
import portality.models as models import portality.util as util from portality.core import app, login_manager from portality.view.account import blueprint as account from portality.view.nav import blueprint as nav from portality.view.media import blueprint as media from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.hooks import blueprint as hooks from portality.view.api import blueprint as api from portality.view.pagemanager import blueprint as pagemanager from portality.view.feed import blueprint as feed app.register_blueprint(account, url_prefix='/account') app.register_blueprint(nav, url_prefix='/nav') app.register_blueprint(media, url_prefix='/media') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(hooks, url_prefix='/hooks') app.register_blueprint(api, url_prefix='/api') app.register_blueprint(feed) app.register_blueprint(pagemanager) @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out
from portality.core import app, login_manager from portality.view.swap.account import blueprint as account from portality.view.swap.admin import blueprint as admin from portality.view.swap.courses import blueprint as courses from portality.view.swap.forms import blueprint as forms from portality.view.swap.progression import blueprint as progression from portality.view.swap.imports import blueprint as imports from portality.view.swap.exports import blueprint as exports from portality.view.graph import blueprint as graph from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream app.register_blueprint(account, url_prefix="/account") app.register_blueprint(admin, url_prefix="/admin") app.register_blueprint(courses, url_prefix="/courses") app.register_blueprint(forms, url_prefix="/registration") app.register_blueprint(progression, url_prefix="/progression") app.register_blueprint(imports, url_prefix="/admin/import") app.register_blueprint(exports, url_prefix="/admin/export") app.register_blueprint(graph, url_prefix="/graph") app.register_blueprint(query, url_prefix="/query") app.register_blueprint(stream, url_prefix="/stream") @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid)
from portality.view.account import blueprint as account from portality.view.admin import blueprint as admin from portality.view.publisher import blueprint as publisher from portality.view.query import blueprint as query from portality.view.doaj import blueprint as doaj from portality.view.oaipmh import blueprint as oaipmh from portality.view.openurl import blueprint as openurl from portality.view.atom import blueprint as atom from portality.view.editor import blueprint as editor from portality.view.doajservices import blueprint as services if 'api' in app.config['FEATURES']: from portality.view.api_v1 import blueprint as api_v1 from portality.view.status import blueprint as status from portality.lib.normalise import normalise_doi app.register_blueprint(account, url_prefix='/account') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(publisher, url_prefix='/publisher') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(query, url_prefix="/admin_query") app.register_blueprint(query, url_prefix="/publisher_query") app.register_blueprint(query, url_prefix="/editor_query") app.register_blueprint(query, url_prefix="/associate_query") app.register_blueprint(editor, url_prefix='/editor') app.register_blueprint(services, url_prefix='/service') if 'api' in app.config['FEATURES']: app.register_blueprint(api_v1, url_prefix='/api/v1') app.register_blueprint(status, url_prefix='/_status') app.register_blueprint(status, url_prefix='/status') # TODO: remove duplicate route once uptimerobot has been informed app.register_blueprint(oaipmh)
"""Check remote_user on a per-request basis.""" remote_user = request.headers.get('REMOTE_USER', '') if remote_user: user = models.Account.pull(remote_user) if user: login_user(user, remember=False) # add a check for provision of api key elif 'api_key' in request.values: res = models.Account.query(q='api_key:"' + request.values['api_key'] + '"')['hits']['hits'] if len(res) == 1: user = models.Account.pull(res[0]['_source']['id']) if user: login_user(user, remember=False) app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(account, url_prefix='/account') app.register_blueprint(query, url_prefix='/user_query') app.register_blueprint(query, url_prefix='/admin_query') app.register_blueprint(advert, url_prefix='/advert') @app.route("/") def root(): if current_user.is_authenticated() and current_user.has_role("user"): return render_template("search.html", search_base_url="") else: return redirect(url_for("welcome")) @app.route("/welcome") def welcome():
from flask import Flask, request, abort, render_template, redirect, make_response, jsonify, send_file, \ send_from_directory from flask.views import View from portality.core import app from portality.lib.webapp import custom_static from portality.runner import start_from_main from service import models from portality.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix='/query') @app.route("/") def root(): return render_template("index.html") @app.route("/stats") def stats(): return render_template("stats.html") @app.route("/reactor/<reactor_id>") def reactor(reactor_id): r = models.Reactor.pull(reactor_id) return render_template("reactor.html", reactor=r, map_key=app.config.get("GOOGLE_MAP_API_KEY")) @app.route("/map") def map(): return render_template("map.html", map_key=app.config.get("GOOGLE_MAP_API_KEY")) @app.route("/country/<country>") def nation(country):
from flask.ext.login import login_user, current_user import json import portality.models as models import portality.util as util from portality.core import app, login_manager from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.account import blueprint as account from portality.view.api import blueprint as api from portality.view.media import blueprint as media from portality.view.pagemanager import blueprint as pagemanager app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(account, url_prefix='/account') app.register_blueprint(api, url_prefix='/api') app.register_blueprint(media, url_prefix='/media') app.register_blueprint(pagemanager) @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out @app.context_processor def set_current_context():
from portality.view.account import blueprint as account from portality.view.sitemap import blueprint as sitemap from portality.view.tagging import blueprint as tagging from portality.view.media import blueprint as media from portality.view.admin import blueprint as admin from portality.view.graph import blueprint as graph from portality.view.contact import blueprint as contact from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.package import blueprint as package from portality.view.padthru import blueprint as padthru from portality.view.search import blueprint as search from portality.view.jsite import blueprint as jsite app.register_blueprint(account, url_prefix='/account') app.register_blueprint(sitemap, url_prefix='/sitemap') app.register_blueprint(tagging, url_prefix='/tagging') app.register_blueprint(media, url_prefix='/media') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(graph, url_prefix='/graph') app.register_blueprint(contact, url_prefix='/contact') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(package, url_prefix='/package') app.register_blueprint(padthru, url_prefix='/padthru') app.register_blueprint(search, url_prefix='/search') app.register_blueprint(jsite) @login_manager.user_loader
from portality.core import app, login_manager from portality.view.leaps.account import blueprint as account from portality.view.leaps.admin import blueprint as admin from portality.view.leaps.universities import blueprint as universities from portality.view.leaps.schools import blueprint as schools from portality.view.leaps.forms import blueprint as forms from portality.view.leaps.imports import blueprint as imports from portality.view.leaps.exports import blueprint as exports from portality.view.graph import blueprint as graph from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream app.register_blueprint(account, url_prefix='/account') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(universities, url_prefix='/universities') app.register_blueprint(schools, url_prefix='/schools') app.register_blueprint(forms, url_prefix='/survey') app.register_blueprint(imports, url_prefix='/admin/import') app.register_blueprint(exports, url_prefix='/admin/export') app.register_blueprint(graph, url_prefix='/graph') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') @login_manager.user_loader def load_account_for_login_manager(userid):
from flask.ext.login import login_user, current_user import portality.models as models from portality.core import app, login_manager from portality.view.account import blueprint as account from portality.view.graph import blueprint as graph from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.question import blueprint as question from portality.view.answer import blueprint as answer from portality.view.mine import blueprint as mine from portality.view.leviathan import blueprint as leviathan app.register_blueprint(account, url_prefix='/account') app.register_blueprint(graph, url_prefix='/graph') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(question, url_prefix='/question') app.register_blueprint(answer, url_prefix='/answer') app.register_blueprint(mine, url_prefix='/mine') app.register_blueprint(leviathan) @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out @app.context_processor
from portality.view.account import blueprint as account from portality.view.admin import blueprint as admin from portality.view.publisher import blueprint as publisher from portality.view.query import blueprint as query from portality.view.doaj import blueprint as doaj from portality.view.oaipmh import blueprint as oaipmh from portality.view.openurl import blueprint as openurl from portality.view.atom import blueprint as atom from portality.view.editor import blueprint as editor from portality.view.doajservices import blueprint as services if 'api' in app.config['FEATURES']: from portality.view.api_v1 import blueprint as api_v1 from portality.view.status import blueprint as status from portality.lib.normalise import normalise_doi app.register_blueprint(account, url_prefix='/account') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(publisher, url_prefix='/publisher') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(query, url_prefix="/admin_query") app.register_blueprint(query, url_prefix="/publisher_query") app.register_blueprint(query, url_prefix="/editor_query") app.register_blueprint(query, url_prefix="/associate_query") app.register_blueprint(editor, url_prefix='/editor') app.register_blueprint(services, url_prefix='/service') if 'api' in app.config['FEATURES']: app.register_blueprint(api_v1, url_prefix='/api/v1') app.register_blueprint(status, url_prefix='/status') app.register_blueprint(oaipmh) app.register_blueprint(openurl)
from portality.core import app, login_manager from portality import settings from portality.view.account import blueprint as account from portality.view.admin import blueprint as admin from portality.view.publisher import blueprint as publisher from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.forms import blueprint as forms from portality.view.doaj import blueprint as doaj from portality.view.oaipmh import blueprint as oaipmh from portality.view.atom import blueprint as atom from portality.view.editor import blueprint as editor from portality.view.doajservices import blueprint as services app.register_blueprint(account, url_prefix='/account') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(publisher, url_prefix='/publisher') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(query, url_prefix="/admin_query") app.register_blueprint(query, url_prefix="/publisher_query") app.register_blueprint(query, url_prefix="/editor_query") app.register_blueprint(query, url_prefix="/associate_query") app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(forms, url_prefix='/forms') app.register_blueprint(editor, url_prefix='/editor') app.register_blueprint(services, url_prefix='/service') app.register_blueprint(oaipmh) app.register_blueprint(atom) app.register_blueprint(doaj)
"""Check remote_user on a per-request basis.""" remote_user = request.headers.get('REMOTE_USER', '') if remote_user: user = models.Account.pull(remote_user) if user: login_user(user, remember=False) # add a check for provision of api key elif 'api_key' in request.values: res = models.Account.query(q='api_key:"' + request.values['api_key'] + '"')['hits']['hits'] if len(res) == 1: user = models.Account.pull(res[0]['_source']['id']) if user: login_user(user, remember=False) app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(account, url_prefix='/account') app.register_blueprint(stream, url_prefix='/stream') @app.route("/") def root(): return render_template("index.html", api_base_url=app.config.get("OARR_API_BASE_URL", "http://*****:*****@app.route("/map") def mapp(): return render_template("map.html") @app.route("/contribute") def contribute():
from flask import Flask, request, abort, render_template, make_response from flask.views import View from flask.ext.login import login_user, current_user import portality.models as models import portality.util as util from portality.core import app, login_manager from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.account import blueprint as account from portality.view.api import blueprint as api app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(account, url_prefix='/account') app.register_blueprint(api, url_prefix='/api') @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out @app.context_processor def set_current_context(): """ Set some template context globals. """ return dict(current_user=current_user, app=app)
from portality.view.account import blueprint as account from portality.view.nav import blueprint as nav from portality.view.media import blueprint as media from portality.view.admin import blueprint as admin from portality.view.graph import blueprint as graph from portality.view.contact import blueprint as contact from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.pagemanager import blueprint as pagemanager from portality.view.feed import blueprint as feed from portality.view.crawler import blueprint as crawler from portality.view.parser import blueprint as parser app.register_blueprint(account, url_prefix='/account') app.register_blueprint(nav, url_prefix='/nav') app.register_blueprint(media, url_prefix='/media') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(graph, url_prefix='/graph') app.register_blueprint(contact, url_prefix='/contact') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(feed) app.register_blueprint(pagemanager) app.register_blueprint(crawler, url_prefix='/crawler') app.register_blueprint(parser, url_prefix='/parser') @login_manager.user_loader
import json import portality.models as models import portality.util as util from portality.core import app, login_manager from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.account import blueprint as account from portality.view.api import blueprint as api from portality.view.media import blueprint as media from portality.view.pagemanager import blueprint as pagemanager app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(account, url_prefix='/account') app.register_blueprint(api, url_prefix='/api') app.register_blueprint(media, url_prefix='/media') app.register_blueprint(pagemanager) @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out @app.context_processor def set_current_context(): """ Set some template context globals. """
from portality.core import app, login_manager from portality.view.forms import dropdowns from portality.view.account import blueprint as account from portality.view.admin import blueprint as admin from portality.view.graph import blueprint as graph from portality.view.contact import blueprint as contact from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.organisation import blueprint as organisation from portality.view.project import blueprint as project from portality.view.person import blueprint as person app.register_blueprint(account, url_prefix='/account') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(graph, url_prefix='/graph') app.register_blueprint(contact, url_prefix='/contact') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(organisation, url_prefix="/organisation") app.register_blueprint(project, url_prefix="/project") app.register_blueprint(person, url_prefix="/person") @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out
from portality.core import app, login_manager from portality.view.wikipedia import wikiparse from portality.view.account import blueprint as account from portality.view.media import blueprint as media from portality.view.graph import blueprint as graph from portality.view.contact import blueprint as contact from portality.view.query import blueprint as query from portality.view.stream import blueprint as stream from portality.view.package import blueprint as package from portality.view.pagemanager import blueprint as pagemanager from portality.view.forms import blueprint as forms from portality.view.annotations import blueprint as annotations app.register_blueprint(account, url_prefix='/account') app.register_blueprint(media, url_prefix='/media') app.register_blueprint(graph, url_prefix='/graph') app.register_blueprint(contact, url_prefix='/contact') app.register_blueprint(query, url_prefix='/query') app.register_blueprint(stream, url_prefix='/stream') app.register_blueprint(package, url_prefix='/package') app.register_blueprint(forms, url_prefix='/forms') app.register_blueprint(annotations, url_prefix='/annotator') app.register_blueprint(pagemanager) @login_manager.user_loader def load_account_for_login_manager(userid): out = models.Account.pull(userid) return out