This commit is contained in:
Andy McKay 2012-01-10 10:08:40 -08:00
Родитель 6e315a1103
Коммит 255cd69532
1 изменённых файлов: 16 добавлений и 11 удалений

Просмотреть файл

@ -9,6 +9,7 @@ import waffle
import amo
from amo.helpers import loc
from amo.urlresolvers import reverse
from amo.utils import memoize
from access import acl
from cake.urlresolvers import remora_url
from zadmin.models import get_config
@ -30,6 +31,20 @@ def i18n(request):
}
@memoize('collect-timings')
def get_collect_timings():
# The flag has to be enabled for everyone and then we'll use that
# percentage in the pages.
percent = 0
try:
flag = waffle.models.Flag.objects.get(name='collect-timings')
if flag.everyone and flag.percent:
percent = float(flag.percent) / 100.0
except waffle.models.Flag.DoesNotExist:
pass
return percent
def global_settings(request):
"""
Storing standard AMO-wide information used in global headers, such as
@ -110,20 +125,10 @@ def global_settings(request):
else:
context['amo_user'] = AnonymousUser()
# The flag has to be enabled for everyone and then we'll use that
# percentage in the pages.
percent = 0
try:
flag = waffle.models.Flag.objects.get(name='collect-timings')
if flag.everyone and flag.percent:
percent = float(flag.percent) / 100.0
except waffle.models.Flag.DoesNotExist:
pass
context.update({'account_links': account_links,
'settings': settings, 'amo': amo,
'tools_links': tools_links,
'tools_title': tools_title,
'ADMIN_MESSAGE': get_config('site_notice'),
'collect_timings_percent': percent})
'collect_timings_percent': get_collect_timings()})
return context