from core.build.subnet import build_subnet
from core.network.models import Network
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse

import pdb


def build_network(request, network_pk):
    network = get_object_or_404(Network, pk=network_pk)
    if request.GET.pop("raw", False):
        DEBUG_BUILD_STRING = build_subnet(network, raw=True)
        return HttpResponse(DEBUG_BUILD_STRING)
    else:
        DEBUG_BUILD_STRING = build_subnet(network, raw=False)
        return render_to_response('build/sample_build.html',
                {'data': DEBUG_BUILD_STRING, 'network': network})

from core.build.subnet import build_subnet
from core.network.models import Network
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse

import pdb


def build_network(request, network_pk):
    network = get_object_or_404(Network, pk=network_pk)
    if request.GET.get('raw'):
        DEBUG_BUILD_STRING = build_subnet(network, raw=True)
        return HttpResponse(DEBUG_BUILD_STRING)
    else:
        DEBUG_BUILD_STRING = build_subnet(network, raw=False)
        return render_to_response('build/sample_build.html',
                {'data': DEBUG_BUILD_STRING, 'network': network})

Revert "use pop instead of get because it doens't cause uncaught exceptions."
Revert "use pop instead of get because it doens't cause uncaught exceptions."

This reverts commit 7aa3e4128b9df890a2683faee0ebe2ee8e64ce33.
