Fix some debug prints + HttpResponse for Gravatar

parent b463f9f9
Pipeline #1966 passed with stage
in 7 minutes and 25 seconds
......@@ -143,9 +143,6 @@ if 'POSTGRESQL_DATABASE' in os.environ:
'HOST': 'postgresql',
}
if os.path.isfile(os.path.join(BASE_DIR, 'config_local.py')):
from config_local import * # noqa # flake8: noqa # NOQA # pragma: no cover
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
USE_X_FORWARDED_HOST = True
......@@ -198,3 +195,7 @@ CACHES = {
CACHE_IMAGES_MAX_AGE = 5 * 60
CACHE_RESPONSE = False
# This MUST BE THE LAST!
if os.path.isfile(os.path.join(BASE_DIR, 'config_local.py')):
from config_local import * # noqa # flake8: noqa # NOQA # pragma: no cover
......@@ -322,7 +322,8 @@ class GravatarProxyView(View):
gravatar_test_url = 'https://secure.gravatar.com/avatar/' + kwargs['digest'] \
+ '?s=%i' % 50
if cache.get(gravatar_test_url) == 'default':
print("Cached Gravatar response: Default.")
# DEBUG only
# print("Cached Gravatar response: Default.")
return redir_default(default)
try:
testdata = urlopen(gravatar_test_url, timeout=URL_TIMEOUT)
......@@ -365,8 +366,7 @@ class GravatarProxyView(View):
data = BytesIO(gravatarimagedata.read())
img = Image.open(data)
data.seek(0)
response = CachingHttpResponse(
uri,
response = HttpResponse(
data.read(),
content_type='image/%s' % file_format(img.format))
response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment