def get_certificate_header_context(is_secure=True): """ Return data to be used in Certificate Header, data returned should be customized according to the site configuration. """ data = dict( logo_src=branding_api.get_logo_url(is_secure), logo_url=branding_api.get_base_url(is_secure), ) return data
def test_cdn_urls_for_logo(self): # Ordinarily, we'd use `override_settings()` to override STATIC_URL, # which is what the staticfiles storage backend is using to construct the URL. # Unfortunately, other parts of the system are caching this value on module # load, which can cause other tests to fail. To ensure that this change # doesn't affect other tests, we patch the `url()` method directly instead. cdn_url = "http://cdn.example.com/static/image.png" with mock.patch('branding.api.staticfiles_storage.url', return_value=cdn_url): logo_url = get_logo_url() self.assertEqual(logo_url, cdn_url)
def completion(self, request, suffix=''): context = { "logo": branding_api.get_logo_url(False), "course": get_course_by_id(self.course_id), "footer": branding_api.get_footer(False), "completed_survey": self.verify_completion(), "css": self.resource_string("static/css/surveymonkey.css"), } return Response( LOADER.render_template( "static/html/surveymonkey_completion_page.html", context))
def render_navigation_logo(context,**pageargs): __M_caller = context.caller_stack._push_frame() try: is_secure = context.get('is_secure', UNDEFINED) static = _mako_get_namespace(context, 'static') def navigation_logo(): return render_navigation_logo(context) __M_writer = context.writer() __M_writer(u'\n <img class="logo" src="') __M_writer(filters.html_escape(filters.decode.utf8(branding_api.get_logo_url(is_secure)))) __M_writer(u'" alt="') __M_writer(filters.html_escape(filters.decode.utf8(_("{platform_name} Home Page").format(platform_name=static.get_platform_name())))) __M_writer(u'"/>\n ') return '' finally: context.caller_stack._pop_frame()