From e9046e891cffdbc194fde477a80e3891236d0dbb Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 08 2018 08:04:12 +0000 Subject: [PATCH 1/5] Drop the dependency on flask-multistatic Signed-off-by: Pierre-Yves Chibon --- diff --git a/dev/ansible/roles/pagure-dev/tasks/main.yml b/dev/ansible/roles/pagure-dev/tasks/main.yml index 236d7c5..a67e8e4 100644 --- a/dev/ansible/roles/pagure-dev/tasks/main.yml +++ b/dev/ansible/roles/pagure-dev/tasks/main.yml @@ -38,7 +38,6 @@ - python-fedora-flask - python-flask - python-flask-wtf - - python-flask-multistatic - python2-jinja2 - python-markdown - python-munch diff --git a/dev/docker/ev b/dev/docker/ev index 9bb1eba..005ee26 100644 --- a/dev/docker/ev +++ b/dev/docker/ev @@ -7,7 +7,7 @@ RUN mkdir /code RUN dnf install -y python2-devel python-setuptools python-nose py-bcrypt python-alembic \ python-arrow python-binaryornot python-bleach python-blinker \ python-chardet python-cryptography python-docutils python-flask \ - python-flask-wtf python-flask-multistatic python-markdown python-psutil \ + python-flask-wtf python-markdown python-psutil \ python-pygit2 python-fedora python-openid python-openid-cla \ python-openid-teams python-straight-plugin python-wtforms python-munch \ python-enum34 python-redis python-sqlalchemy systemd gitolite3 python-filelock \ diff --git a/dev/docker/logcom b/dev/docker/logcom index 957bc5f..3bc8e12 100644 --- a/dev/docker/logcom +++ b/dev/docker/logcom @@ -7,7 +7,7 @@ RUN mkdir /code RUN dnf install -y python2-devel python-setuptools python-nose python2-bcrypt python-alembic \ python-arrow python-binaryornot python-bleach python-blinker \ python-chardet python-cryptography python-docutils python-flask \ - python-flask-wtf python-flask-multistatic python-markdown python-psutil \ + python-flask-wtf python-markdown python-psutil \ python-pygit2 python-fedora python-openid python-openid-cla \ python-openid-teams python-straight-plugin python-wtforms python-munch \ python-enum34 python-redis python-sqlalchemy systemd gitolite3 python-filelock \ diff --git a/dev/docker/web b/dev/docker/web index 89e9277..78594b0 100644 --- a/dev/docker/web +++ b/dev/docker/web @@ -7,7 +7,7 @@ RUN mkdir /code RUN dnf install -y python2-devel python-setuptools python-nose python2-bcrypt python-alembic \ python-arrow python-binaryornot python-bleach python-blinker \ python-chardet python-cryptography python-docutils python-flask \ - python-flask-wtf python-flask-multistatic python-markdown python-psutil \ + python-flask-wtf python-markdown python-psutil \ python-pygit2 python-fedora python-openid python-openid-cla \ python-openid-teams python-straight-plugin python-wtforms python-munch \ python-enum34 python-redis python-sqlalchemy systemd gitolite3 python-filelock \ diff --git a/dev/docker/worker b/dev/docker/worker index 0fec307..c2c57c4 100644 --- a/dev/docker/worker +++ b/dev/docker/worker @@ -7,7 +7,7 @@ RUN mkdir /code RUN dnf install -y python2-devel python-setuptools python-nose python2-bcrypt python-alembic \ python-arrow python-binaryornot python-bleach python-blinker \ python-chardet python-cryptography python-docutils python-flask \ - python-flask-wtf python-flask-multistatic python-markdown python-psutil \ + python-flask-wtf python-markdown python-psutil \ python-pygit2 python-fedora python-openid python-openid-cla \ python-openid-teams python-straight-plugin python-wtforms python-munch \ python-enum34 python-redis python-sqlalchemy systemd gitolite3 python-filelock \ diff --git a/dev/run-tests-docker.py b/dev/run-tests-docker.py index 2a71c95..f1531ac 100755 --- a/dev/run-tests-docker.py +++ b/dev/run-tests-docker.py @@ -9,7 +9,7 @@ TEMPLATE = 'dev/docker/test_env_template' PKG_LIST = 'python-alembic python-arrow python-binaryornot \ \n'\ 'python-bleach python-blinker python-chardet python-cryptography \ \n'\ 'python-docutils python-enum34 python-flask python2-fedora-flask \ \n'\ - 'python-flask-wtf python-flask-multistatic python2-bcrypt python-jinja2 \ \n'\ + 'python-flask-wtf python2-bcrypt python-jinja2 \ \n'\ 'python-markdown python-munch python-openid-cla python-openid-teams \ \n'\ 'python-psutil python-pygit2 python2-pillow \ \n'\ 'python-sqlalchemy python-straight-plugin python-wtforms python-nose \ \n'\ diff --git a/files/pagure.spec b/files/pagure.spec index aaac48c..63a185c 100644 --- a/files/pagure.spec +++ b/files/pagure.spec @@ -46,7 +46,6 @@ Requires: python%{python_pkgversion}-cryptography Requires: python%{python_pkgversion}-docutils Requires: python%{python_pkgversion}-enum34 Requires: python%{python_pkgversion}-flask -Requires: python%{python_pkgversion}-flask-multistatic Requires: python%{python_pkgversion}-flask-wtf Requires: python%{python_pkgversion}-markdown Requires: python%{python_pkgversion}-munch diff --git a/pagure/flask_app.py b/pagure/flask_app.py index b494006..294db1e 100644 --- a/pagure/flask_app.py +++ b/pagure/flask_app.py @@ -19,8 +19,6 @@ import os import flask import pygit2 -from flask_multistatic import MultiStaticFlask - import pagure.doc_utils import pagure.exceptions import pagure.forms @@ -58,7 +56,7 @@ if pagure_config.get('PAGURE_CI_SERVICES'): def create_app(config=None): """ Create the flask application. """ - app = MultiStaticFlask(__name__) + app = flask.Flask(__name__) app.config = pagure_config if config: diff --git a/requirements-fedora.txt b/requirements-fedora.txt index dbf7e4e..45e170c 100644 --- a/requirements-fedora.txt +++ b/requirements-fedora.txt @@ -10,7 +10,6 @@ python-enum34 python-fedora-flask python-flask python-flask-wtf -python-flask-multistatic py-bcrypt python-jinja2 python-markdown diff --git a/requirements.txt b/requirements.txt index 3a6bce0..96bab20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,6 @@ docutils enum34 flask<1.0 flask-wtf -flask-multistatic kitchen markdown munch From eac6d9b204e98789fe77e983e99cf80d3aba21d3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 08 2018 08:04:33 +0000 Subject: [PATCH 2/5] The configuration variable for the theme is capitalized Signed-off-by: Pierre-Yves Chibon --- diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index 0f06931..ee13399 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -15,7 +15,7 @@ to your Pagure configuration: :: - theme = "pagureio" + THEME = "pagureio" Theme contents From 530a3bce19c1ef1e52175b3832dfbb82bdf6a20d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 08 2018 08:04:49 +0000 Subject: [PATCH 3/5] Deprecate the bootstrap URLs in the configuration Signed-off-by: Pierre-Yves Chibon --- diff --git a/doc/configuration.rst b/doc/configuration.rst index aa51002..4992b37 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -107,26 +107,6 @@ Defaults to: ``'redis://%s' % APP.config['REDIS_HOST']`` key -BOOTSTRAP_URLS_CSS -~~~~~~~~~~~~~~~~~~ - -This configuration key allows to specify the URL where are hosted the bootstrap -CSS file since the files hosted on apps.fedoraproject.org used in pagure.io -are not restricted in browser access. - -Defaults to: ``'https://apps.fedoraproject.org/global/fedora-bootstrap-1.1.1/fedora-bootstrap.css'`` - - -BOOTSTRAP_URLS_JS -~~~~~~~~~~~~~~~~~ - -This configuration key allows to specify the URL where are hosted the bootstrap -JS file since the files hosted on apps.fedoraproject.org used in pagure.io -are not restricted in browser access. - -Defaults to: ``'https://apps.fedoraproject.org/global/fedora-bootstrap-1.1.1/fedora-bootstrap.js'`` - - Repo Directories ---------------- @@ -1536,3 +1516,30 @@ will not have syntax highlighting as this is a memory intensive procedure that easily leads to out of memory error on large files or diff. Defaults to: ``5000`` + + +BOOTSTRAP_URLS_CSS +~~~~~~~~~~~~~~~~~~ + +This configuration key allows to specify the URL where are hosted the bootstrap +CSS file since the files hosted on apps.fedoraproject.org used in pagure.io +are not restricted in browser access. + +Defaults to: ``'https://apps.fedoraproject.org/global/fedora-bootstrap-1.1.1/fedora-bootstrap.css'`` + +This has been deprecated by the new way of theming pagure, see the `theming +documentation `_ + + +BOOTSTRAP_URLS_JS +~~~~~~~~~~~~~~~~~ + +This configuration key allows to specify the URL where are hosted the bootstrap +JS file since the files hosted on apps.fedoraproject.org used in pagure.io +are not restricted in browser access. + +Defaults to: ``'https://apps.fedoraproject.org/global/fedora-bootstrap-1.1.1/fedora-bootstrap.js'`` + +This has been deprecated by the new way of theming pagure, see the `theming +documentation `_ + From 7c6f2800cd7520ea61e1fae005c6d396fb9b2739 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 08 2018 08:06:35 +0000 Subject: [PATCH 4/5] Drop support for THEME_TEMPLATE_FOLDER Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/flask_app.py b/pagure/flask_app.py index 294db1e..7d91964 100644 --- a/pagure/flask_app.py +++ b/pagure/flask_app.py @@ -78,21 +78,6 @@ def create_app(config=None): # request. app.before_request(perfrepo.reset_stats) - if pagure_config.get('THEME_TEMPLATE_FOLDER', False): - # Jinja can be told to look for templates in different folders - # That's what we do here - template_folder = pagure_config['THEME_TEMPLATE_FOLDER'] - if template_folder[0] != '/': - template_folder = os.path.join( - app.root_path, app.template_folder, template_folder) - import jinja2 - # Jinja looks for the template in the order of the folders specified - templ_loaders = [ - jinja2.FileSystemLoader(template_folder), - app.jinja_loader, - ] - app.jinja_loader = jinja2.ChoiceLoader(templ_loaders) - auth = pagure_config.get('PAGURE_AUTH', None) if auth in ['fas', 'openid']: # Only import and set flask_fas_openid if it is needed From 60577d18bb1190d63593c558fdda77e3fcbc30ee Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 08 2018 08:07:15 +0000 Subject: [PATCH 5/5] Simplify retrieving the theme name Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/flask_app.py b/pagure/flask_app.py index 7d91964..d619baf 100644 --- a/pagure/flask_app.py +++ b/pagure/flask_app.py @@ -112,10 +112,7 @@ def create_app(config=None): from pagure.internal import PV # noqa: E402 app.register_blueprint(PV) - if pagure_config.get('THEME', False): - themename = pagure_config['THEME'] - else: - themename = "default" + themename = pagure_config.get('THEME', 'default') themeblueprint = flask.Blueprint( 'theme', __name__, static_url_path='/theme/static',