From 31fb73a15d12559b15f5506622c3902476d3ea0f Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 22 Feb 2006 22:14:19 +0000 Subject: cleanup the plugins to fit the new namespace --- lib/python/Plugins/Extensions/WebInterface/plugin.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/python/Plugins/Extensions/WebInterface/plugin.py (limited to 'lib/python/Plugins/Extensions/WebInterface/plugin.py') diff --git a/lib/python/Plugins/Extensions/WebInterface/plugin.py b/lib/python/Plugins/Extensions/WebInterface/plugin.py new file mode 100644 index 00000000..f0be4e45 --- /dev/null +++ b/lib/python/Plugins/Extensions/WebInterface/plugin.py @@ -0,0 +1,19 @@ +from Plugins.Plugin import PluginDescriptor + +def startWebserver(): + from twisted.internet import reactor + from twisted.web2 import server, http, static + toplevel = static.File("/hdd") + site = server.Site(toplevel) + + reactor.listenTCP(80, http.HTTPFactory(site)) + +def autostart(reason): + if reason == 0: + try: + startWebserver() + except ImportError: + print "twisted not available, not starting web services" + +def Plugins(): + return PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) -- cgit v1.2.3