Skip to content

Commit

Permalink
Remove references
Browse files Browse the repository at this point in the history
  • Loading branch information
michplunkett committed Dec 18, 2024
1 parent 1223572 commit be3b78d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 53 deletions.
3 changes: 0 additions & 3 deletions OpenOversight/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from flask_limiter.util import get_remote_address
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sitemap import Sitemap
from flask_wtf.csrf import CSRFProtect

from OpenOversight.app.email_client import EmailClient
Expand All @@ -33,7 +32,6 @@
key_func=get_remote_address, default_limits=["100 per minute", "5 per second"]
)

sitemap = Sitemap()
csrf = CSRFProtect()


Expand All @@ -49,7 +47,6 @@ def create_app(config_name="default"):
EmailClient()
limiter.init_app(app)
login_manager.init_app(app)
sitemap.init_app(app)
compress.init_app(app)

from OpenOversight.app.main import main as main_blueprint
Expand Down
15 changes: 0 additions & 15 deletions OpenOversight/app/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
)
from flask_login import current_user, login_required, login_user, logout_user

from OpenOversight.app import sitemap
from OpenOversight.app.auth import auth
from OpenOversight.app.auth.forms import (
ChangeDefaultDepartmentForm,
Expand Down Expand Up @@ -41,18 +40,6 @@


js_loads = ["js/zxcvbn.js", "js/password.js"]
sitemap_endpoints = []


def sitemap_include(view):
sitemap_endpoints.append(view.__name__)
return view


@sitemap.register_generator
def static_routes():
for endpoint in sitemap_endpoints:
yield "auth." + endpoint, {}


@auth.before_app_request
Expand Down Expand Up @@ -84,7 +71,6 @@ def unconfirmed():
return render_template("auth/unconfirmed.html")


@sitemap_include
@auth.route("/login", methods=[HTTPMethod.GET, HTTPMethod.POST])
def login():
form = LoginForm()
Expand Down Expand Up @@ -112,7 +98,6 @@ def logout():
return redirect(url_for("main.index"))


@sitemap_include
@auth.route("/register", methods=[HTTPMethod.GET, HTTPMethod.POST])
def register():
form = RegistrationForm()
Expand Down
36 changes: 1 addition & 35 deletions OpenOversight/app/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from sqlalchemy.orm import contains_eager, joinedload, selectinload
from sqlalchemy.orm.exc import NoResultFound

from OpenOversight.app import limiter, sitemap
from OpenOversight.app import limiter
from OpenOversight.app.auth.forms import LoginForm
from OpenOversight.app.main import main
from OpenOversight.app.main.downloads import (
Expand Down Expand Up @@ -127,19 +127,6 @@
# Ensure the file is read/write by the creator only
SAVED_UMASK = os.umask(0o077)

sitemap_endpoints = []


def sitemap_include(view):
sitemap_endpoints.append(view.__name__)
return view


@sitemap.register_generator
def static_routes():
for endpoint in sitemap_endpoints:
yield "main." + endpoint, {}


def redirect_url(default="main.index"):
return (
Expand All @@ -149,7 +136,6 @@ def redirect_url(default="main.index"):
)


@sitemap_include
@main.route("/")
@main.route("/index")
def index():
Expand All @@ -167,7 +153,6 @@ def set_session_timezone():
return Response("User timezone saved", status=HTTPStatus.OK)


@sitemap_include
@main.route("/browse", methods=[HTTPMethod.GET])
def browse():
departments = Department.query.filter(Department.officers.any()).order_by(
Expand All @@ -176,7 +161,6 @@ def browse():
return render_template("browse.html", departments=departments)


@sitemap_include
@main.route("/find", methods=[HTTPMethod.GET, HTTPMethod.POST])
def get_officer():
form = FindOfficerForm()
Expand Down Expand Up @@ -224,7 +208,6 @@ def redirect_get_started_labeling():
)


@sitemap_include
@main.route("/labels", methods=[HTTPMethod.GET, HTTPMethod.POST])
def get_started_labeling():
form = LoginForm()
Expand Down Expand Up @@ -277,7 +260,6 @@ def sort_images(department_id: int):
)


@sitemap_include
@main.route("/tutorial")
def get_tutorial():
return render_template("tutorial.html")
Expand Down Expand Up @@ -355,12 +337,6 @@ def officer_profile(officer_id: int):
)


@sitemap.register_generator
def sitemap_officers():
for officer in Officer.query.all():
yield "main.officer_profile", {"officer_id": officer.id}


@main.route("/officer/<int:officer_id>/assignment/new", methods=[HTTPMethod.POST])
@ac_or_admin_required
def redirect_add_assignment(officer_id: int):
Expand Down Expand Up @@ -1535,7 +1511,6 @@ def submit_complaint():
)


@sitemap_include
@main.route("/submit", methods=[HTTPMethod.GET, HTTPMethod.POST])
@limiter.limit("5/minute")
def submit_data():
Expand Down Expand Up @@ -1822,7 +1797,6 @@ def download_dept_descriptions_csv(department_id: int):
)


@sitemap_include
@main.route("/download/all", methods=[HTTPMethod.GET])
def all_data():
departments = Department.query.filter(Department.officers.any())
Expand Down Expand Up @@ -1930,13 +1904,11 @@ def upload(department_id: int, officer_id: Optional[int] = None):
)


@sitemap_include
@main.route("/about")
def about_oo():
return render_template("about.html")


@sitemap_include
@main.route("/privacy")
def privacy_oo():
return render_template("privacy.html")
Expand Down Expand Up @@ -2129,12 +2101,6 @@ def populate_obj(self, form: FlaskForm, obj: Incident):
)


@sitemap.register_generator
def sitemap_incidents():
for incident in Incident.query.all():
yield "main.incident_api", {"obj_id": incident.id}


class TextApi(ModelView):
order_by = "created_at"
descending = True
Expand Down

0 comments on commit be3b78d

Please sign in to comment.