config_file = opts.opts['config-file']
config.read(config_file)
-if config.defaults()['username']:
- uid,gid = pwd.getpwnam(config.defaults()['username'])[2:4]
+if config.has_option('DEFAULT', 'username') and config.get('DEFAULT', 'username'):
+ uid,gid = pwd.getpwnam(config.get('DEFAULT', 'username'))[2:4]
else:
uid,gid = None,None
print service.IProcess(application).processName
service.IProcess(application).processName = 'apt-dht'
-DHT = __import__(config.get('DEFAULT', 'DHT'), globals(), locals(), ['DHT'])
+DHT = __import__(config.get('DEFAULT', 'DHT')+'.DHT', globals(), locals(), ['DHT'])
assert(IDHT.implementedBy(DHT.DHT), "You must provide a DHT implementation that implements the IDHT interface.")
myDHT = DHT.DHT()
myDHT.loadConfig(config)
from apt_dht.apt_dht import AptDHT
myapp = AptDHT(myDHT)
site = myapp.getSite()
- s = strports.service('tcp:'+config.defaults()['port'], channel.HTTPFactory(site))
+ s = strports.service('tcp:'+config.get('DEFAULT', 'port'), channel.HTTPFactory(site))
s.setServiceParent(application)
if __name__ == '__main__':