Skip to content
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

silently swallow a couple errors instead of crashing the site. #291

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion councilmatic_core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ def chairs(self):
.select_related("person__councilmatic_person")
)
for chair in chairs:
if chair.person is None:
# Silently continue if a None person was added in scraping,
# instead of crashing the site.
continue
chair.person = chair.person.councilmatic_person
return chairs
else:
Expand Down Expand Up @@ -305,7 +309,10 @@ def current_member(self):
.select_related("person__councilmatic_person")
.first()
)
if membership:
if membership and membership.person:
# Added `and membership.person` to silently
# handle the situation where a None membership gets added.
# And return nothing, instead of crashing the app.
membership.person = membership.person.councilmatic_person
return membership

Expand Down
1 change: 0 additions & 1 deletion councilmatic_core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ def get_context_data(self, **kwargs):
for ces in user.committeeeventsubscriptions.all():
if committee == ces.committee:
context["user_subscribed_events"] = True

return context


Expand Down