@user_passes_test(using_unique_session)
def viewplan(request, planid):
    """
    View a plan. 
    
    This template has no editing capability.
    
    Parameters:
        request -- An HttpRequest, which includes the current user.
        planid -- The plan to view

    Returns:
        A rendered HTML page for viewing a plan.
    """

    if not is_session_available(request) or not is_plan_ready(planid):
        return HttpResponseRedirect('/')

    # Cleanup old versions for logged in users
    if not request.user.is_anonymous() and (int(planid) == 0) and (0 > settings.MAX_UNDOS_AFTER_EDIT):
        for p in Plan.objects.filter(owner=request.user):
            p.purge_beyond_nth_step(settings.MAX_UNDOS_AFTER_EDIT)

    return render_to_response('viewplan.html', commonplan(request, planid))
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/views.py/viewplan/swapped operands of `>`