Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswebb09 committed Dec 24, 2023
1 parent 8b434e7 commit 2dc4671
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 28 deletions.
14 changes: 4 additions & 10 deletions DirectReport/browserview/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
import sys
from pathlib import Path

from flask import Flask, request
from flask import redirect, url_for
from flask import Flask, request, current_app
from flask_login import LoginManager, current_user, login_required
from DirectReport.config import Config


from flask_login import LoginManager, current_user
from DirectReport.browserview.services.github import GithubClient
from DirectReport.browserview.services.prompt_logic import generate_email
from DirectReport.config import Config
from DirectReport.datadependencies import appsecrets
from DirectReport.models.user_model import UserModel


file = Path(__file__).resolve()
package_root_directory = file.parents[1]
sys.path.append(str(package_root_directory))
#
# login_manager = LoginManager()


client_id = appsecrets.GITHUB_CLIENT_ID
client_secret = appsecrets.GITHUB_CLIENT_SECRET
Expand Down Expand Up @@ -50,7 +45,6 @@ def unauthorized_handler():


def create_app(config_class=Config):
user_model = UserModel()
app = Flask(__name__, template_folder="templates")

from DirectReport.browserview.auth import bp as auth_bp
Expand Down
3 changes: 1 addition & 2 deletions DirectReport/browserview/auth/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from flask import Blueprint
from DirectReport.browserview.auth import routes

bp = Blueprint('auth', __name__)

from DirectReport.browserview.auth import routes
9 changes: 5 additions & 4 deletions DirectReport/browserview/auth/routes.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from flask import render_template, request, redirect, url_for, flash
from werkzeug.security import generate_password_hash
from DirectReport.models.user_model import UserModel
from flask_login import login_user, login_required, logout_user, current_user
from werkzeug.security import generate_password_hash

from DirectReport.browserview.auth import bp
from DirectReport.browserview.services.github import GithubClient
from DirectReport.datadependencies import appsecrets
from DirectReport.models.report.report_builder import ReportBuilder
from DirectReport.browserview.services.github import GithubClient
from DirectReport.browserview.auth import bp
from DirectReport.models.user_model import UserModel

user_model = UserModel()

Expand Down
4 changes: 2 additions & 2 deletions DirectReport/browserview/errors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import Blueprint
from DirectReport.browserview.errors import handlers

bp = Blueprint('errors', __name__)

from app.errors import handlers
bp = Blueprint('errors', __name__)
6 changes: 2 additions & 4 deletions DirectReport/browserview/errors/handlers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from flask import render_template, request
from app import db
from app.errors import bp
from app.api.errors import error_response as api_error_response
from DirectReport.browserview.errors import bp
from DirectReport.browserview.api.errors import error_response as api_error_response


def wants_json_response():
Expand All @@ -23,7 +22,6 @@ def page_not_found(e):

@bp.app_errorhandler(500)
def internal_error(error):
db.session.rollback()
if wants_json_response():
return api_error_response(500)
return render_template('errors/500.html'), 500
4 changes: 2 additions & 2 deletions DirectReport/browserview/main/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import Blueprint
from DirectReport.browserview.main import routes

bp = Blueprint('main', __name__)

from DirectReport.browserview.main import routes
bp = Blueprint('main', __name__)
6 changes: 3 additions & 3 deletions DirectReport/browserview/main/routes.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import requests
from datetime import datetime, timedelta

import requests
from flask import render_template, session, request, redirect, json
from datetime import datetime, timedelta
from flask_login import current_user

from DirectReport.browserview.main import bp
from DirectReport.browserview.services.github import GithubClient
from DirectReport.browserview.services.prompt_logic import generate_email
from DirectReport.datadependencies import appsecrets
from DirectReport.browserview.main import bp

client_id = appsecrets.GITHUB_CLIENT_ID
client_secret = appsecrets.GITHUB_CLIENT_SECRET
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ exclude=[
'tests/*'
]
per-file-ignores= [
'DirectReport/__init__.py:F401, F403'
'DirectReport/__init__.py:F401, F403, E402',
'DirectReport/browserview/api/__init__.py:F401, F403, E402',
'DirectReport/browserview/main/routes.py:F401, F403, E402, W503',
'DirectReport/datadependencies/prompts.py:F401, F403, E402, W503'
]


Expand Down

0 comments on commit 2dc4671

Please sign in to comment.