-
Notifications
You must be signed in to change notification settings - Fork 31
Adding Flask_pyoidc and Updating to Python 3.6 #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I think that the structure after your changes are applied is an improvement.
I've left quite a few comments on places where changes under the "Adding flask_pyoidc" commit d214bdf could be moved to a style (or cosmetic) change commit.
Keeping cosmetic changes separate from functional changes allows for easier reviewing and bisecting of commits.
from flask import Flask, redirect, request, render_template, g | ||
from flask_sqlalchemy import SQLAlchemy | ||
from flask_migrate import Migrate | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the style fixes commit.
Also why is this being reordered (and some lines being deleted)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on: https://www.python.org/dev/peps/pep-0008/#imports
The lines being deleted are unused imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then that should be a separate commit from adding pyoidc support.
# pylint: disable=C0413 | ||
from conditional.models.models import UserLog | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
# Configure Logging | ||
def request_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name | ||
def request_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
@@ -52,7 +58,7 @@ def request_processor(logger, log_method, event_dict): # pylint: disable=unused- | |||
return event_dict | |||
|
|||
|
|||
def database_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name | |||
def database_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
conditional/__init__.py
Outdated
|
||
from conditional.blueprints.dashboard import dashboard_bp # pylint: disable=ungrouped-imports | ||
from conditional.blueprints.dashboard import dashboard_bp # pylint: disable=ungrouped-imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
from flask import Blueprint, request, jsonify | ||
|
||
from conditional import db, auth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
from conditional.util.ldap import ldap_get_intro_members | ||
|
||
from conditional.models.models import FreshmanCommitteeAttendance | ||
from conditional import start_of_year, auth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
from flask import Blueprint, request | ||
|
||
from conditional import auth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
conditional/blueprints/slideshow.py
Outdated
|
||
from conditional import db | ||
|
||
from conditional.util.auth import get_username |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
from conditional.models.models import HouseMeeting | ||
from conditional.models.models import MajorProject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to style fixes commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting in this work! Just a few things I think could be moved around or fixed.
conditional/util/auth.py
Outdated
@@ -24,3 +26,13 @@ def wrapped_func(*args, **kwargs): | |||
"is_eval": is_eval}, *args, **kwargs) | |||
|
|||
return wrapped_func | |||
|
|||
|
|||
def get_username(func): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought: Almost every time we use this wrapper we immediately grab their LDAP object, why not just do that in the wrapper and return the user object?
conditional/util/flask.py
Outdated
|
||
# TODO maybe use the webauth request decorator | ||
@get_username | ||
def render_template(template_name, username=None, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my previous comment. We should just include this in the wrapper and then we don't have to worry about it.
@@ -25,5 +26,15 @@ | |||
SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(os.path.join(os.getcwd(), "data.db")) | |||
ZOO_DATABASE_URI = 'mysql+pymysql://user:pass@host/database' | |||
|
|||
# OIDC Config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add some relevant info to the README in the setup instruction section.
42ef6df
to
317cd95
Compare
Addressed the comments left by @mbillow |
Honestly, I don't think that a separate style commit is necessary. It doesn't net us any real benefits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 🎉
Added
flask_oidc
This removes the need for the overarching oidc that causes timeout issues.
I updated to Python 3.6 in order to get that package to work properly, as well as prepare to upgrade ldap in the coming week
Should fix #90