def error_contacting_app(request, url, app, exception):
    if all([exception.status_code, exception.content]):
        log_msg = (
            "Error visiting URL %s for app %s: status code "
            "was %s and error_message %s" % (
                url, app.name, exception.status_code, exception.content
            )
        )
        view_msg = _("TxApp responded with an error: %s" % exception.content)
    else:
        log_msg = "Error contacting remote server: url is %s" % url
        view_msg = _("Error contacting app.")
    logger.error(log_msg)
    return render_to_response(
        'txapp_error.html',
        {
            'app_name': app.name,
            'error_message': view_msg
        },
        context_instance=RequestContext(request)
    )
Allows an `.OrderBy` object to be extracted via named or integer
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/addons/txapps/views.py/error_contacting_app--crossover with--dataset/ETHPy150Open bradleyayers/django-tables2/django_tables2/utils.py/OrderByTuple.__getitem__