<p>You are going to be redirected to the desired content within 5 seconds. If the redirection does not happen automatically please click on <a href="%(url)s">%(url_ok)s</a>.</p>
</body>
</html>"""%{
'url':escape(req.unparsed_uri,True),
'url_ok':escape(req.unparsed_uri)
})
raiseapache.SERVER_RETURN(apache.DONE)
req.headers_out["Location"]=url
ifreq.response_sent_p:
raiseIOError("Cannot redirect after headers have already been sent.")
req.status=redirection_type
req.write('<p>Please go to <a href="%s">here</a></p>\n'%url)
raiseapache.SERVER_RETURN,apache.DONE
defget_referer(req,replace_ampersands=False):
""" Return the referring page of a request.
Referer (wikipedia): Referer is a common misspelling of the word
"referrer"; so common, in fact, that it made it into the official
specification of HTTP. When visiting a webpage, the referer or
referring page is the URL of the previous webpage from which a link was
followed.
@param req: request
@param replace_ampersands: if 1, replace & by & in url
(correct HTML cannot contain & characters alone)
"""
try:
referer=req.headers_in['Referer']
ifreplace_ampersands==1:
returnreferer.replace('&','&')
returnreferer
exceptKeyError:
return''
defdrop_default_urlargd(urlargd,default_urlargd):
lndefault={}
lndefault.update(default_urlargd)
## Commented out. An Invenio URL now should always specify the desired
## language, in order not to raise the automatic language discovery
## (client browser language can be used now in place of CFG_SITE_LANG)