def __init__(self): set_proc_title('globaleaks') self.state = State self.arw = resource.EncodingResourceWrapper(APIResourceWrapper(), [server.GzipEncoderFactory()]) if Settings.nodaemon: self.api_factory = Site(self.arw, logFormatter=logFormatter) else: self.api_factory = Site(self.arw, logPath=Settings.accesslogfile, logFormatter=logFormatter) self.api_factory.displayTracebacks = False
def __init__(self): resource.Resource.__init__(self) self.putChild(b"status", Status()) self.putChild(b"follow", Follow()) self.putChild(b"delay", Delay()) self.putChild(b"partial", Partial()) self.putChild(b"drop", Drop()) self.putChild(b"raw", Raw()) self.putChild(b"echo", Echo()) self.putChild(b"payload", PayloadResource()) self.putChild( b"xpayload", resource.EncodingResourceWrapper(PayloadResource(), [GzipEncoderFactory()])) self.putChild(b"alpayload", ArbitraryLengthPayloadResource()) try: from tests import tests_datadir self.putChild( b"files", File(os.path.join(tests_datadir, 'test_site/files/'))) except Exception: pass self.putChild(b"redirect-to", RedirectTo())
def setUp(self): self.channel = DummyChannel() staticResource = Data(b"Some data", b"text/plain") wrapped = resource.EncodingResourceWrapper( staticResource, [server.GzipEncoderFactory()]) self.channel.site.resource.putChild(b"foo", wrapped)
if PRECALCULATE_DAILY_RESAMPLING: precalculate_daily_resampling() if PRECALCULATE_HEATMAP_DATA: precalculate_heat_map_data() if USING_SSL: sslContext = ssl.DefaultOpenSSLContextFactory( '/cert/privkey.pem', '/cert/cacert.pem', ) root = File("web") root.putChild( 'rms', resource.EncodingResourceWrapper(DataResource(), [server.GzipEncoderFactory()])) root.putChild( 'monitors', resource.EncodingResourceWrapper(MonitorsResource(), [server.GzipEncoderFactory()])) root.putChild( 'heatmap', resource.EncodingResourceWrapper(AnnualHeatMapResource(), [server.GzipEncoderFactory()])) root.putChild( 'waveforms', resource.EncodingResourceWrapper(WaveformResource(), [server.GzipEncoderFactory()])) root.putChild( 'harmonics', resource.EncodingResourceWrapper(HarmonicsResource(),
def get_site(*args, **kwargs): encoders = [server.GzipEncoderFactory()] wrapped = resource.EncodingResourceWrapper( get_root_resource(qs=kwargs['qs']), encoders) site = server.Site(wrapped) return site