Fix up the application to work with then new structure.
[quix0rs-apt-p2p.git] / apt_dht / apt_dht.py
1
2 from twisted.web2 import server, http, http_headers
3
4 from apt_dht_conf import config
5 from HTTPServer import TopLevel
6
7 class AptDHT:
8     def __init__(self):
9         self.http_server = TopLevel(config.defaults()['cache_dir'], self)
10         self.http_site = server.Site(self.http_server)
11     
12     def getSite(self):
13         return self.http_site
14     
15     def check_freshness(self, path, modtime, resp):
16         return resp
17     
18     def get_resp(self, path):
19         return http.Response(
20             200,
21             {'content-type': http_headers.MimeType('text', 'html')},
22             """<html><body>
23             <h2>P2P Download</h2>
24             <p>TODO: eventually this will cause a P2P lookup.</body></html>""")