示例#1
0
文件: views.py 项目: fergalmoran/dss
def app(request):
    if "HTTP_USER_AGENT" in request.META:
        if request.META["HTTP_USER_AGENT"].startswith("facebookexternalhit"):
            logger.debug("Redirecting facebook hit")
            return social_redirect(request)

    context = {"is_bot": request.user_agent.is_bot, "socket_io": settings.SOCKET_IO_JS_URL, "bust": uuid.uuid1()}

    if request.user_agent.browser.family == "___Firefox___":
        context[
            "ua_html"
        ] = """<div class="alert alert-block alert-warning">
                    <button type="button" class="close" data-dismiss="alert">
                        <i class="fa fa-times"></i>
                    </button>
                    <i class="fa fa-eye"></i>
                    <strong>Hello Firefox user.</strong> If you are having any problems with the site, please do a
                    <a href="#" onclick="location.reload(true);">&nbsp;full refresh</a> (CTRL-F5)<br/>
                    <i class="fa fa-ambulance"></i>
                    if you're still having problems, please clear your cache (CTRL-SHIFT-DEL).
                </div>"""

    return render_to_response("inc/app.html", context, context_instance=RequestContext(request))
示例#2
0
文件: views.py 项目: fergalmoran/dss
def default(request):
    if "HTTP_USER_AGENT" in request.META and request.META["HTTP_USER_AGENT"].startswith("facebookexternalhit"):
        return social_redirect(request)

    backbone_url = "http://%s/#%s" % (request.get_host(), rreplace(lreplace(request.path, "/", ""), "/", ""))
    return redirect(backbone_url)
示例#3
0
文件: views.py 项目: fergalmoran/dss
def _app(request):
    return social_redirect(request)