Add a waffle.flag in order to force overlay usage

This commit is contained in:
James Polley 2018-01-21 00:12:06 +11:00
parent 763f69cb61
commit 23c056e046

View file

@ -1116,8 +1116,11 @@ def _get_badge_template_name():
@login_required
def user_badge(request, format="png"):
'''Shows the logged-in user their badge'''
return render_badge(request.user, format)
if waffle.flag_is_active("force_badge_overlay"):
overlay=True
else:
overlay=False
return render_badge(request.user, format, overlay)
@user_passes_test(_staff_only)
def badge(request, user_id, format="png"):
@ -1147,6 +1150,8 @@ def _convert_img(img, outformat="png",dpi=200,width=None):
return out
def render_badge(user, format="png", overlay=False):
if waffle.flag_is_active("force_badge_overlay"):
overlay=True
rendered = render_badge_svg(user, overlay=overlay)
if format == "png":
rendered = _convert_img(rendered, outformat="png")