def get_canonical_and_alternates_urls(<EOL>url,<EOL>drop_ln=True,<EOL>washed_argd=None,<EOL>quote_path=False):
dummy_scheme, dummy_netloc, path, dummy_params, query, fragment = urlparse(<EOL>url)<EOL>canonical_scheme, canonical_netloc = urlparse(cfg.get('<STR_LIT>'))[<NUM_LIT:0>:<NUM_LIT:2>]<EOL>parsed_query = washed_argd or parse_qsl(query)<EOL>no_ln_parsed_query = [(key, value)<EOL>for (key, value) in parsed_query if key != '<STR_LIT>']<EOL>if drop_ln:<EOL><INDENT>canonical_parsed_query = no_ln_parsed_query<EOL><DEDENT>else:<EOL><INDENT>canonical_parsed_query = parsed_query<EOL><DEDENT>if quote_path:<EOL><INDENT>path = urllib.quote(path)<EOL><DEDENT>canonical_query = urlencode(canonical_parsed_query)<EOL>canonical_url = urlunparse(<EOL>(canonical_scheme,<EOL>canonical_netloc,<EOL>path,<EOL>dummy_params,<EOL>canonical_query,<EOL>fragment))<EOL>alternate_urls = {}<EOL>for ln in cfg.get('<STR_LIT>'):<EOL><INDENT>alternate_query = urlencode(no_ln_parsed_query + [('<STR_LIT>', ln)])<EOL>alternate_url = urlunparse(<EOL>(canonical_scheme,<EOL>canonical_netloc,<EOL>path,<EOL>dummy_params,<EOL>alternate_query,<EOL>fragment))<EOL>alternate_urls[ln] = alternate_url<EOL><DEDENT>return canonical_url, alternate_urls<EOL>
Given an Invenio URL returns a tuple with two elements. The first is the
canonical URL, that is the original URL with CFG_SITE_URL prefix, and
where the ln= argument stripped. The second element element is mapping,
language code -> alternate URL

@param quote_path: if True, the path section of the given C{url}
                   is quoted according to RFC 2396