Allow admin to set default avatar explicitly. #263

Merged
merged 1 commit into from Feb 26, 2014

Conversation

Projects
None yet
2 participants
Contributor

ralphbean commented Feb 26, 2014

This is to get around a heisenbug we're seing in production, where
sometimes the request.static_url returns the url of badges.fp.o, and
other times it returns localhost. Very frustrating.

If we just let the admin hardcode it, everything will be easier.

@ralphbean ralphbean Allow admin to set default avatar explicitly.
This is to get around a heisenbug we're seing in production, where
*sometimes* the request.static_url returns the url of badges.fp.o, and
*other* times it returns localhost.  Very frustrating.

If we just let the admin hardcode it, everything will be easier.
5aa1927

@pypingou pypingou commented on the diff Feb 26, 2014

tahrir/utils.py
@@ -90,9 +90,9 @@ def make_avatar_method(cache):
@cache.cache_on_arguments()
def _avatar_function(email, size):
request = pyramid.threadlocal.get_current_request()
- theme_name = request.registry.settings.get('tahrir.theme_name', 'tahrir')
- absolute_default = request.static_url(
- '%s:static/img/badger_avatar.png' % theme_name)
+ absolute_default = request.registry.settings.get(
+ 'tahrir.default_avatar',
+ 'https://badges.fedoraproject.org/static/img/badger_avatar.png')
@pypingou

pypingou Feb 26, 2014

Owner

configurable?

@ralphbean

ralphbean Feb 26, 2014

Contributor

Yup. request.registry.settings is the config from /etc/tahrir/tahrir.ini

@pypingou

pypingou Feb 26, 2014

Owner

oh sorry I missed it was pulling the info from settings.

Owner

pypingou commented Feb 26, 2014

👍

ralphbean merged commit 640ee21 into develop Feb 26, 2014

1 check failed

default PEP8bot detected 218 errors
Details

ralphbean deleted the feature/default-avatar branch Feb 26, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment