[sagenb] 05/06: Update to flask 0.11.1 API, what's currently in Debian
Ximin Luo
infinity0 at debian.org
Mon Oct 3 22:30:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository sagenb.
commit b9d830070f7d9d44293fa80c3d02ecc843ea6358
Author: Ximin Luo <infinity0 at pwned.gg>
Date: Tue Oct 4 00:22:15 2016 +0200
Update to flask 0.11.1 API, what's currently in Debian
---
debian/.gitignore | 2 +
debian/patches/series | 1 +
debian/patches/update-flask-0.11.patch | 186 +++++++++++++++++++++++++++++++++
3 files changed, 189 insertions(+)
diff --git a/debian/.gitignore b/debian/.gitignore
new file mode 100644
index 0000000..6a09d42
--- /dev/null
+++ b/debian/.gitignore
@@ -0,0 +1,2 @@
+# override obnoxious rule in upstream .gitignore
+!*.patch
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..acc96c5
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+update-flask-0.11.patch
diff --git a/debian/patches/update-flask-0.11.patch b/debian/patches/update-flask-0.11.patch
new file mode 100644
index 0000000..f0180d0
--- /dev/null
+++ b/debian/patches/update-flask-0.11.patch
@@ -0,0 +1,186 @@
+Description: Update to Flask 0.11.1 API
+Author: Ximin Luo <infinity0 at debian.org>
+Forwarded: TBD
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/sagenb/flask_version/admin.py
++++ b/sagenb/flask_version/admin.py
+@@ -1,10 +1,10 @@
+ import os
+-from flask import Module, url_for, render_template, request, session, redirect, g, current_app
++from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app
+ from decorators import login_required, admin_required, with_lock
+-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext
++from flask_babel import Babel, gettext, ngettext, lazy_gettext
+ _ = gettext
+
+-admin = Module('sagenb.flask_version.admin')
++admin = Blueprint('admin', 'sagenb.flask_version.admin')
+
+ @admin.route('/users')
+ @admin.route('/users/reset/<reset>')
+--- a/sagenb/flask_version/authentication.py
++++ b/sagenb/flask_version/authentication.py
+@@ -1,11 +1,11 @@
+ import os
+ import random
+-from flask import Module, url_for, render_template, request, session, redirect, g, current_app
++from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app
+ from decorators import with_lock
+-from flask.ext.babel import gettext, ngettext, lazy_gettext
++from flask_babel import gettext, ngettext, lazy_gettext
+ _ = gettext
+
+-authentication = Module('sagenb.flask_version.authentication')
++authentication = Blueprint('authentication', 'sagenb.flask_version.authentication')
+
+ ##################
+ # Authentication #
+--- a/sagenb/flask_version/base.py
++++ b/sagenb/flask_version/base.py
+@@ -1,7 +1,7 @@
+ #!/usr/bin/env python
+ import os, time, re
+ from functools import partial
+-from flask import Flask, Module, url_for, request, session, redirect, g, make_response, current_app, render_template
++from flask import Flask, Blueprint, url_for, request, session, redirect, g, make_response, current_app, render_template
+ from decorators import login_required, guest_or_login_required, with_lock
+ from decorators import global_lock
+ # Make flask use the old session foo from <=flask-0.9
+@@ -11,7 +11,7 @@
+ from sage.env import SAGE_SRC, SAGE_DOC
+ SRC = os.path.join(SAGE_SRC, 'sage')
+ from flask.ext.openid import OpenID
+-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext, get_locale
++from flask_babel import Babel, gettext, ngettext, lazy_gettext, get_locale
+ from sagenb.misc.misc import SAGENB_ROOT, DATA, translations_path, N_, nN_, unicode_str
+ from json import dumps
+ from sagenb.notebook.cell import number_of_rows
+@@ -83,7 +83,7 @@
+ return render_template(os.path.join('html', 'error_message.html'),
+ **template_dict)
+
+-base = Module('sagenb.flask_version.base')
++base = Blueprint('base', 'sagenb.flask_version.base')
+
+ #############
+ # Main Page #
+@@ -443,6 +443,7 @@
+ #this function must be modified to add per user language support
+ @babel.localeselector
+ def get_locale():
++ set_notebook_object() # hacky workaround, Sage devs can supply the "proper fix"
+ return g.notebook.conf()['default_language']
+
+ ########################
+--- a/sagenb/flask_version/doc.py
++++ b/sagenb/flask_version/doc.py
+@@ -14,13 +14,13 @@
+
+ """
+ import os
+-from flask import Module, url_for, render_template, request, session, redirect, g, current_app
++from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app
+ from decorators import login_required, guest_or_login_required
+
+-from flask.ext.babel import gettext, ngettext, lazy_gettext
++from flask_babel import gettext, ngettext, lazy_gettext
+ _ = gettext
+
+-doc = Module('sagenb.flask_version.doc')
++doc = Blueprint('doc', 'sagenb.flask_version.doc')
+
+ from sage.env import SAGE_DOC
+ DOC = os.path.join(SAGE_DOC, 'html', 'en')
+--- a/sagenb/flask_version/settings.py
++++ b/sagenb/flask_version/settings.py
+@@ -1,12 +1,12 @@
+ import os
+ import random
+-from flask import Module, url_for, render_template, request, session, redirect, g, current_app
++from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app
+ from decorators import login_required, with_lock
+-from flask.ext.babel import gettext, ngettext, lazy_gettext
++from flask_babel import gettext, ngettext, lazy_gettext
+ _ = gettext
+
+
+-settings = Module('sagenb.flask_version.settings')
++settings = Blueprint('settings', 'sagenb.flask_version.settings')
+
+ @settings.route('/settings', methods = ['GET','POST'])
+ @login_required
+--- a/sagenb/flask_version/worksheet.py
++++ b/sagenb/flask_version/worksheet.py
+@@ -1,17 +1,17 @@
+ import re
+ import os, threading, collections
+ from functools import wraps
+-from flask import Module, make_response, url_for, render_template, request, session, redirect, g, current_app
++from flask import Blueprint, make_response, url_for, render_template, request, session, redirect, g, current_app
+ from decorators import login_required, with_lock
+ from collections import defaultdict
+ from werkzeug.utils import secure_filename
+-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext
++from flask_babel import Babel, gettext, ngettext, lazy_gettext
+ _ = gettext
+
+ from sagenb.notebook.interact import INTERACT_UPDATE_PREFIX
+ from sagenb.notebook.misc import encode_response
+
+-ws = Module('sagenb.flask_version.worksheet')
++ws = Blueprint('worksheet', 'sagenb.flask_version.worksheet')
+ worksheet_locks = defaultdict(threading.Lock)
+
+ def worksheet_view(f):
+@@ -664,7 +664,7 @@
+ this URI to get one or more base64-encoded data files.
+ """
+ # Defaults taken from upstream jsmol.php
+- query = request.values.get('query',
++ query = request.values.get('query',
+ "http://cactus.nci.nih.gov/chemical/structure/ethanol/file?format=sdf&get3d=True")
+ call = request.values.get('call', u'getRawDataFromDatabase')
+ database = request.values.get('database', '_')
+@@ -673,11 +673,11 @@
+ current_app.logger.debug('JSmol call: %s', call)
+ current_app.logger.debug('JSmol query: %s', query)
+ if encoding == None:
+- def encoder(x):
++ def encoder(x):
+ return x
+ elif encoding == u'base64':
+ import base64
+- def encoder(x):
++ def encoder(x):
+ # JSmol expects the magic ';base64,' in front of output
+ return ';base64,' + base64.encodestring(x)
+ else:
+--- a/sagenb/flask_version/worksheet_listing.py
++++ b/sagenb/flask_version/worksheet_listing.py
+@@ -2,12 +2,12 @@
+ """
+ import os
+ import urllib, urlparse
+-from flask import Module, url_for, render_template, request, session, redirect, g, current_app
++from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app
+ from decorators import login_required, guest_or_login_required, with_lock
+-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext
++from flask_babel import Babel, gettext, ngettext, lazy_gettext
+ _ = gettext
+
+-worksheet_listing = Module('sagenb.flask_version.worksheet_listing')
++worksheet_listing = Blueprint('worksheet_listing', 'sagenb.flask_version.worksheet_listing')
+
+ def render_worksheet_list(args, pub, username):
+ """
+--- a/sagenb/flask_version/decorators.py
++++ b/sagenb/flask_version/decorators.py
+@@ -1,6 +1,6 @@
+ from functools import wraps
+ from flask import Flask, url_for, render_template, request, session, redirect, g, current_app
+-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext
++from flask_babel import Babel, gettext, ngettext, lazy_gettext
+ _ = gettext
+
+ from threading import Lock
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git
More information about the debian-science-commits
mailing list