pvl/verkko/hosts.py
changeset 183 8fbaaf0564dc
parent 180 e6bca452ce72
child 186 0bfb34281141
equal deleted inserted replaced
180:e6bca452ce72 183:8fbaaf0564dc
     4 from pvl.web import html
     4 from pvl.web import html
     5 
     5 
     6 import re
     6 import re
     7 import datetime
     7 import datetime
     8 import socket # dns
     8 import socket # dns
     9 import math
       
    10 
     9 
    11 import logging; log = logging.getLogger('pvl.verkko.hosts')
    10 import logging; log = logging.getLogger('pvl.verkko.hosts')
    12 
    11 
    13 ## Model
    12 ## Model
    14 import json
    13 import json
   146 class HostsTable (table.Table) :
   145 class HostsTable (table.Table) :
   147     """
   146     """
   148         Table of hosts.
   147         Table of hosts.
   149     """
   148     """
   150 
   149 
       
   150     ITEMS   = "Hosts"
   151     COLUMNS = (
   151     COLUMNS = (
   152         table.Column('ip',    "IP",       Host.ip,        
   152         table.Column('ip',    "IP",       Host.ip,        
   153             rowfilter   = True,
   153             rowfilter   = True,
   154         ),
   154         ),
   155         table.Column('mac',   "MAC",      Host.mac,       Host.render_mac,
   155         table.Column('mac',   "MAC",      Host.mac,       Host.render_mac,
   164         ),
   164         ),
   165     )
   165     )
   166     
   166     
   167     # XXX: have to set again
   167     # XXX: have to set again
   168     ATTRS = dict((col.attr, col) for col in COLUMNS)
   168     ATTRS = dict((col.attr, col) for col in COLUMNS)
   169 
       
   170     # XXX: set later
       
   171     TABLE_URL = ITEM_URL = None
       
   172 
   169 
   173     # default
   170     # default
   174     SORT = Host.last_seen.desc()
   171     SORT = Host.last_seen.desc()
   175     PAGE = 10
   172     PAGE = 10
   176 
   173