From 12d5c9b281245a1cf7fab462deaa1b09489548b0 Mon Sep 17 00:00:00 2001 From: Renzo Lucioni Date: Mon, 8 Sep 2014 17:33:02 -0400 Subject: [PATCH] Do not call upper on a profile country code of None --- common/djangoapps/embargo/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/djangoapps/embargo/middleware.py b/common/djangoapps/embargo/middleware.py index e7c199cc6e..99c911c320 100644 --- a/common/djangoapps/embargo/middleware.py +++ b/common/djangoapps/embargo/middleware.py @@ -166,7 +166,7 @@ class EmbargoMiddleware(object): profile_country = cache.get(cache_key) if profile_country is None: profile = getattr(user, 'profile', None) - if profile is not None and profile.country is not None: + if profile is not None and profile.country.code is not None: profile_country = profile.country.code.upper() else: profile_country = ""