def _on_rendered_wrapper(error, rendered_page): '''Called when rendering the wrapper is complete.''' if error is not None: callback(error, None) return try: response_bytes = EosCompanionAppService.string_to_bytes( pipeline( rendered_page, lambda content: _RE_EKN_URL_CAPTURE.sub( ekn_url_rewriter(version, query), content ), lambda content: _RE_RESOURCE_URL_CAPTURE.sub( resource_url_rewriter(version, query), content ), lambda content: _RE_LICENSE_URL_CAPTURE.sub( license_url_rewriter(version, query), content ) ) ) except GLib.Error as render_bytes_error: callback(render_bytes_error, None) return callback(None, response_bytes)
def _render_license_css_content(content_bytes, version, query, source_path): '''Render the CSS license content by rewriting all the URIs.''' unrendered_css_string = EosCompanionAppService.bytes_to_string( content_bytes) return EosCompanionAppService.string_to_bytes( _RE_CSS_URL_CAPTURE.sub( relative_css_url_rewriter(version, query, source_path), unrendered_css_string))