Ejemplo n.º 1
0
 def __init__(self):
     self.listing = Listing()
     self.whitelisting = WhiteListing()
     self.rule = Rule()
     self.asnum = ASNum()
     self.subnet = Subnet()
     self.rir = RIR()
     self.country = Country()
     self.peering = Peering()
Ejemplo n.º 2
0
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext

from blacklist.common.broker import Broker
from blacklist.middleware.rule import Rule
from blacklist.table.rule import RuleTable
from blacklist.forms.rule import RuleForm

broker = Broker()
rule = Rule()


@login_required
def rules(request):
    (result, rule_data) = rule.all()
    if not result: return HttpResponseRedirect("/")

    try:
        page = int(request.GET.get('page', '1'))
    except:
        page = 1

    rule_table = RuleTable(rule_data,
                           order_by=request.GET.get('sort', 'title'))

    return render_to_response("rule/overview.html", {
        "rule_table": rule_table,