def rewrite_to_secure_url(url, secure_base=None):
if secure_base is None:<EOL><INDENT>secure_base = cfg.get('<STR_LIT>')<EOL><DEDENT>url_parts = list(urlparse(url))<EOL>url_secure_parts = urlparse(secure_base)<EOL>url_parts[<NUM_LIT:0>] = url_secure_parts[<NUM_LIT:0>]<EOL>url_parts[<NUM_LIT:1>] = url_secure_parts[<NUM_LIT:1>]<EOL>return urlunparse(url_parts)<EOL>
Rewrite URL to a Secure URL

@param url URL to be rewritten to a secure URL.
@param secure_base: Base URL of secure site (defaults to CFG_SITE_SECURE_URL).