Browse Source

Start updating flask and flask modules

master
Chase Sterling 7 years ago
parent
commit
f7bb21dd2b
4 changed files with 19 additions and 18 deletions
  1. +4
    -3
      realms/__init__.py
  2. +7
    -7
      realms/modules/wiki/views.py
  3. +2
    -2
      realms/templates/layout.html
  4. +6
    -6
      setup.py

+ 4
- 3
realms/__init__.py View File

@@ -180,9 +180,10 @@ def create_app(config=None):

db.Model = declarative_base(metaclass=HookModelMeta, cls=HookMixin)

for status_code in httplib.responses:
if status_code >= 400:
app.register_error_handler(status_code, error_handler)
# TODO: This caused a crash with a more recent flask. Figure out what it does.
# for status_code in httplib.responses:
# if status_code >= 400:
# app.register_error_handler(status_code, error_handler)

@app.before_request
def init_g():


+ 7
- 7
realms/modules/wiki/views.py View File

@@ -11,7 +11,7 @@ blueprint = Blueprint('wiki', __name__)

@blueprint.route("/_commit/<sha>/<path:name>")
def commit(name, sha):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()

cname = to_canonical(name)
@@ -26,7 +26,7 @@ def commit(name, sha):

@blueprint.route(r"/_compare/<path:name>/<regex('\w+'):fsha><regex('\.{2,3}'):dots><regex('\w+'):lsha>")
def compare(name, fsha, dots, lsha):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()

diff = g.current_wiki.get_page(name, sha=lsha).compare(fsha)
@@ -41,7 +41,7 @@ def revert():
commit = request.form.get('commit')
message = request.form.get('message', "Reverting %s" % cname)

if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous():
if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous:
return dict(error=True, message="Anonymous posting not allowed"), 403

if cname in current_app.config.get('WIKI_LOCKED_PAGES'):
@@ -63,7 +63,7 @@ def revert():

@blueprint.route("/_history/<path:name>")
def history(name):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()
return render_template('wiki/history.html', name=name)

@@ -165,7 +165,7 @@ def _tree_index(items, path=""):
@blueprint.route("/_index", defaults={"path": ""})
@blueprint.route("/_index/<path:path>")
def index(path):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()

items = g.current_wiki.get_index()
@@ -186,7 +186,7 @@ def page_write(name):
if not cname:
return dict(error=True, message="Invalid name")

if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous():
if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous:
return dict(error=True, message="Anonymous posting not allowed"), 403

if request.method == 'POST':
@@ -230,7 +230,7 @@ def page_write(name):
@blueprint.route("/", defaults={'name': 'home'})
@blueprint.route("/<path:name>")
def page(name):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()

cname = to_canonical(name)


+ 2
- 2
realms/templates/layout.html View File

@@ -58,7 +58,7 @@
</div>
</form>
</li>
{% if current_user.is_authenticated() %}
{% if current_user.is_authenticated %}
<li class="dropdown user-avatar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span>
@@ -109,7 +109,7 @@
{% endfor %}

var User = {};
User.is_authenticated = {{ current_user.is_authenticated()|tojson }};
User.is_authenticated = {{ current_user.is_authenticated|tojson }};
{% for attr in ['username', 'email'] %}
User.{{ attr }} = {{ current_user[attr]|tojson }};
{% endfor %}


+ 6
- 6
setup.py View File

@@ -23,14 +23,14 @@ setup(name='realms-wiki',
version=__version__,
packages=find_packages(),
install_requires=[
'Flask==0.10.1',
'Flask-Assets==0.10',
'Flask==0.11.1',
'Flask-Assets==0.11',
'Flask-Cache==0.13.1',
'Flask-Elastic==0.2',
'Flask-Login==0.2.11',
'Flask-OAuthlib==0.9.1',
'Flask-SQLAlchemy==2.0',
'Flask-WTF==0.10.2',
'Flask-Login==0.3.2',
'Flask-OAuthlib==0.9.3',
'Flask-SQLAlchemy==2.1',
'Flask-WTF==0.12',
'PyYAML==3.11',
'bcrypt==1.0.2',
'beautifulsoup4==4.3.2',


Loading…
Cancel
Save