def get_template_names(self): version = self.kwargs.get('version') or '' locale = l10n_utils.get_locale(self.request) # variant is present for growth tests ctx = funnelcake_param(self.request) variant = ctx.get('funnelcake_id', None) if variant == '35' and version == '35.0.1': template = 'firefox/australis/growth-firstrun-test1.html' elif variant == '36' and version == '35.0.1': template = 'firefox/australis/growth-firstrun-test2.html' elif show_devbrowser_firstrun_or_whatsnew(version): if (waffle.switch_is_active('dev-edition-spring-campaign')): template = 'firefox/dev-firstrun-spring-campaign.html' else: template = 'firefox/dev-firstrun.html' elif show_38_0_5_firstrun_or_whatsnew(version): template = 'firefox/australis/fx38_0_5/firstrun.html' elif show_36_firstrun(version): template = 'firefox/australis/fx36/firstrun-tour.html' elif show_search_firstrun(version) and locale == 'en-US': template = 'firefox/australis/firstrun-34-tour.html' else: template = 'firefox/australis/firstrun-tour.html' # return a list to conform with original intention return [template]
def get_template_names(self): version = self.kwargs.get('fx_version') or '' locale = l10n_utils.get_locale(self.request) fc_ctx = funnelcake_param(self.request) f = fc_ctx.get('funnelcake_id', 0) oldversion = self.request.GET.get('oldversion', '') # old versions of Firefox sent a prefixed version if oldversion.startswith('rv:'): oldversion = oldversion[3:] versions = ('29.', '30.', '31.', '32.', '33.') if version == '29.0a1': template = 'firefox/whatsnew-nightly-29.html' elif version.startswith(versions): if locale == 'en-US' and f == '31': # funnelcake build 31 should always get the tour template = 'firefox/australis/whatsnew-tour.html' elif locale == 'en-US' and f == '30': # funnelcake build 30 should not get the tour template = 'firefox/australis/whatsnew-no-tour.html' elif show_whatsnew_tour(oldversion): # updating from pre-29 version template = 'firefox/australis/whatsnew-tour.html' else: # default is no tour template = 'firefox/australis/whatsnew-no-tour.html' elif locale in self.fxos_locales: template = 'firefox/whatsnew-fxos.html' else: template = 'firefox/whatsnew.html' # return a list to conform with original intention return [template]
def get_template_names(self): version = self.kwargs.get('fx_version') or '' locale = l10n_utils.get_locale(self.request) fc_ctx = funnelcake_param(self.request) f = fc_ctx.get('funnelcake_id', 0) oldversion = self.request.GET.get('oldversion', '') versions = ('29.', '30.', '31.') if version == '29.0a1': template = 'firefox/whatsnew-nightly-29.html' elif version.startswith(versions): if locale == 'en-US' and f == '31': # funnelcake build 31 should always get the tour template = 'firefox/australis/whatsnew-tour.html' elif locale == 'en-US' and f == '30': # funnelcake build 30 should not get the tour template = 'firefox/australis/whatsnew-no-tour.html' elif show_whatsnew_tour(oldversion): # updating from pre-29 version template = 'firefox/australis/whatsnew-tour.html' else: # default is no tour template = 'firefox/australis/whatsnew-no-tour.html' elif locale in self.fxos_locales: template = 'firefox/whatsnew-fxos.html' else: template = 'firefox/whatsnew.html' # return a list to conform with original intention return [template]
def get_template_names(self): version = self.kwargs.get("version") or "" locale = l10n_utils.get_locale(self.request) # variant is present for growth tests ctx = funnelcake_param(self.request) variant = ctx.get("funnelcake_id", None) if variant == "35" and version == "35.0.1": template = "firefox/australis/growth-firstrun-test1.html" elif variant == "36" and version == "35.0.1": template = "firefox/australis/growth-firstrun-test2.html" elif show_devbrowser_firstrun_or_whatsnew(version): if waffle.switch_is_active("dev-edition-spring-campaign"): template = "firefox/dev-firstrun-spring-campaign.html" else: template = "firefox/dev-firstrun.html" elif show_38_0_5_firstrun_or_whatsnew(version): template = "firefox/australis/fx38_0_5/firstrun.html" elif show_36_firstrun(version): template = "firefox/australis/fx36/firstrun-tour.html" elif show_search_firstrun(version) and locale == "en-US": template = "firefox/australis/firstrun-34-tour.html" else: template = "firefox/australis/firstrun-tour.html" # return a list to conform with original intention return [template]
def get_template_names(self): locale = l10n_utils.get_locale(self.request) fc_ctx = funnelcake_param(self.request) if locale == "en-US" and fc_ctx.get("funnelcake_id", 0) == self.funnelcake_campaign: template = "firefox/firstrun-a.html" else: template = "firefox/firstrun.html" return template
def get_template_names(self): locale = l10n_utils.get_locale(self.request) fc_ctx = funnelcake_param(self.request) if (locale == 'en-US' and fc_ctx.get('funnelcake_id', 0) == self.funnelcake_campaign): template = 'firefox/firstrun-a.html' else: template = 'firefox/firstrun.html' return template
def get_template_names(self): locale = l10n_utils.get_locale(self.request) fc_ctx = funnelcake_param(self.request) f = fc_ctx.get('funnelcake_id', 0) if f == '30' and locale == 'en-US': template = 'firefox/australis/firstrun-no-tour.html' else: template = 'firefox/australis/firstrun-tour.html' # return a list to conform with original intention return [template]
def latest_fx_redirect(request, fake_version, template_name): """ Redirect visitors based on their user-agent. - Up-to-date Firefox users see the whatsnew page. - Other Firefox users go to the new page. - Non Firefox users go to the new page. """ query = request.META.get('QUERY_STRING') query = '?' + query if query else '' user_agent = request.META.get('HTTP_USER_AGENT', '') if not 'Firefox' in user_agent: url = reverse('firefox.new') + query # TODO : Where to redirect bug 757206 return HttpResponsePermanentRedirect(url) user_version = '0' match = UA_REGEXP.search(user_agent) if match: user_version = match.group(1) if not is_current_or_newer(user_version): url = reverse('firefox.new') + query return HttpResponsePermanentRedirect(url) # display alternate firstrun content for en-US with proper funnelcake param in URL # remove when firstrun test is complete context = funnelcake_param(request) if (template_name == 'firefox/firstrun.html' and request.locale == 'en-US' and context.get('funnelcake_id', 0) == FX_FIRSTRUN_FUNNELCAKE_CAMPAIGN): return l10n_utils.render(request, 'firefox/firstrun/a.html') else: locales_with_video = { 'en-US': 'american', 'en-GB': 'british', 'de': 'german_final', 'it': 'italian_final', 'ja': 'japanese_final', 'es-AR': 'spanish_final', 'es-CL': 'spanish_final', 'es-ES': 'spanish_final', 'es-MX': 'spanish_final', } return l10n_utils.render(request, template_name, {'locales_with_video': locales_with_video})
def get_context_data(self, **kwargs): ctx = super(FirstrunView, self).get_context_data(**kwargs) # Firstrun 38.0.5 context - can be removed when these tests are complete ctx = funnelcake_param(self.request) funnelcake_id = ctx.get('funnelcake_id', None) # funnelcake 39 prevents video regardless of locale if (funnelcake_id != '39'): locale = l10n_utils.get_locale(self.request) ctx['video_url'] = LOCALE_SPRING_CAMPAIGN_VIDEOS.get(locale, False) else: ctx['video_url'] = False return ctx
def get_template_names(self): version = self.args[0] locale = l10n_utils.get_locale(self.request) fc_ctx = funnelcake_param(self.request) f = fc_ctx.get('funnelcake_id', 0) if isAustralis(version): if f == '30': template = 'firefox/australis/firstrun-no-tour.html' elif f == '31': template = 'firefox/australis/firstrun-tour.html' else: template = 'firefox/australis/firstrun-tour.html' else: template = 'firefox/australis/firstrun-no-tour.html' # return a list to conform with original intention return [template]
def get_template_names(self): version = self.kwargs.get('fx_version') or '' locale = l10n_utils.get_locale(self.request) fc_ctx = funnelcake_param(self.request) f = fc_ctx.get('funnelcake_id', 0) oldversion = self.request.GET.get('oldversion', '') if oldversion == '29.0' or (f == '30' and locale == 'en-US'): template = 'firefox/australis/whatsnew-no-tour.html' elif version == '29.0a1': template = 'firefox/whatsnew-nightly-29.html' elif version.startswith('29.'): # non en-US locales always get the tour template = 'firefox/australis/whatsnew-tour.html' elif locale in self.fxos_locales: template = 'firefox/whatsnew-fxos.html' else: template = 'firefox/whatsnew.html' # return a list to conform with original intention return [template]
def get_template_names(self): version = self.kwargs.get('version') or '' locale = l10n_utils.get_locale(self.request) # variant is present for growth tests ctx = funnelcake_param(self.request) variant = ctx.get('funnelcake_id', None) if variant == '35' and version == '35.0.1': template = 'firefox/australis/growth-firstrun-test1.html' elif variant == '36' and version == '35.0.1': template = 'firefox/australis/growth-firstrun-test2.html' elif show_devbrowser_firstrun(version): template = 'firefox/dev-firstrun.html' elif show_search_firstrun(version) and locale == 'en-US': template = 'firefox/australis/firstrun-34-tour.html' else: template = 'firefox/australis/firstrun-tour.html' # return a list to conform with original intention return [template]
def _funnelcake(self, url='/', **kwargs): return funnelcake_param(self.rf.get(url, kwargs))
def _funnelcake(self, **kwargs): return funnelcake_param(self.rf.get('/', kwargs))