On 01:20 pm, [email protected] wrote:

Am 08.11.2013 um 19:43 schrieb Axel Rau <[email protected]>:

makeService expects a protocol factory, but I have only
        meteoFactory = Site(resource)
How do I interface the former to the http protocol?


After fixing my low-level Python errors (sorry for wasting you time), the attached plugin works out of the box with my original code:
---
resource = RootWeatherPage()
meteo_factory = Site(resource)
---

If you want to run multiple services then the pattern to follow is just:


   def makeService(config):
       parent = MultiService()
       oneChild.setServiceParent(parent)
       anotherChild.setServiceParent(parent)
       ...
       return parent

You may also want to consider using offering endpoints via the command- line configuration options. Instead of writing options to explicitly support IPv4 and IPv6, write an option that accepts an endpoint string description.

You can see an example of this (sort of) in the implementation of "twistd mail" which accepts endpoints for several of its option (eg `--pop3`):

https://twistedmatrix.com/trac/browser/trunk/twisted/mail/tap.py#L103

You can also read about endpoints here:

 https://twistedmatrix.com/documents/current/core/howto/endpoints.html

and here:

 https://twistedmatrix.com/documents/current/core/howto/servers.html

Jean-Paul

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to