Skip to content
Merged
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
2 changes: 1 addition & 1 deletion common/djangoapps/embargo/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _is_embargoed_by_profile_country(self, user, course_id="", course_is_embargo
profile_country = cache.get(cache_key)
if profile_country is None:
profile = getattr(user, 'profile', None)
if profile is not None:
if profile is not None and profile.country is not None:
profile_country = profile.country.code.upper()
else:
profile_country = ""
Expand Down
1 change: 1 addition & 0 deletions common/djangoapps/embargo/tests/test_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def test_ip_network_exceptions(self):
self.assertEqual(response.status_code, 200)

@ddt.data(
(None, False),
("", False),
("us", False),
("CU", True),
Expand Down