routes = dict \
(
-- test = test_func,
dhcp = DhcpHandler(
pickle_dir = 'var/lib/pymin/pickle/dhcp',
config_dir = 'var/lib/pymin/config/dhcp',
),
- )
+ dns = DnsHandler(
+ pickle_dir = 'var/lib/pymin/pickle/dns',
+ config_dir = 'var/lib/pymin/config/dns',
++ ),
+ firewall = FirewallHandler(
+ pickle_dir = 'var/lib/pymin/pickle/firewall',
+ config_dir = 'var/lib/pymin/config/firewall',
+ ),
)
bind_addr = \
response = u'ERROR '
except Exception, e:
import traceback
- result = u'Internal server error'
+ result = u'Internal server error\n'
traceback.print_exc() # TODO logging!
response = u'ERROR '
if result is None:
- response += u'0'
+ response += u'0\n'
else:
response += u'%d\n%s' % (len(result), result)
self.file.sendto(response, addr)
if __name__ == '__main__':
- from dispatcher import handler
-
- @handler
+ @handler(u"Print all the arguments, return nothing.")
def test_handler(*args):
print 'test:', args
- @handler
+ @handler(u"Echo the message passed as argument.")
def echo_handler(message):
print 'echo:', message
return message
# vim: set encoding=utf-8 et sw=4 sts=4 :
from services.dhcp import DhcpHandler
+from services.dns import DnsHandler
+ from services.firewall import FirewallHandler