pvl/verkko/hosts.py
changeset 1 731d2df704f0
parent 0 91c739202f06
child 3 5990b188c54b
equal deleted inserted replaced
0:91c739202f06 1:731d2df704f0
     4 
     4 
     5 import socket # dns
     5 import socket # dns
     6 
     6 
     7 import logging; log = logging.getLogger('pvl.verkko.hosts')
     7 import logging; log = logging.getLogger('pvl.verkko.hosts')
     8 
     8 
       
     9 # XXX: this should actually be DHCPHost
     9 class Host (object) :
    10 class Host (object) :
    10     DATE_FMT = '%Y%m%d'
    11     DATE_FMT = '%Y%m%d'
    11 
    12 
    12     def __init__ (self, ip, mac, name=None) :
    13     def __init__ (self, ip, mac, name=None) :
    13         self.ip = ip
    14         self.ip = ip
   129         ),
   130         ),
   130 
   131 
   131         html.h2('Related'),
   132         html.h2('Related'),
   132         render_hosts(hosts),
   133         render_hosts(hosts),
   133 
   134 
   134         html.a(href='/')(html('«'), 'Back'),
   135         html.a(href='/hosts')(html('«'), 'Back'),
   135     )
   136     )
   136 
       
   137 from werkzeug.wrappers import Response
       
   138 
   137 
   139 def respond (request, db, path) :
   138 def respond (request, db, path) :
   140     """
   139     """
   141         Handle request
   140         Handle request
   142     """
   141     """
   191         return Response("Not Found", status=404)
   190         return Response("Not Found", status=404)
   192 
   191 
   193     # render
   192     # render
   194     html = web.render_layout(title, html)
   193     html = web.render_layout(title, html)
   195 
   194 
   196     return Response(html, content_type='text/html; charset=UTF-8')
   195     return web.Response(html, content_type='text/html; charset=UTF-8')
   197 
   196