aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-07-17 13:56:37 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-07-17 13:56:37 +0000
commit954106887a9b77a26753c5613ff368ce4c997044 (patch)
treed1a1a1967d7a77a2e3d6cf871dc74911b180dd69 /lib/python
parent982001658e3e55d320d747717fcf8e56c2cec1b6 (diff)
downloadenigma2-954106887a9b77a26753c5613ff368ce4c997044.tar.gz
enigma2-954106887a9b77a26753c5613ff368ce4c997044.zip
move xml files into web/, support hierarchy
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Plugins/Extensions/WebInterface/Makefile.am5
-rw-r--r--lib/python/Plugins/Extensions/WebInterface/plugin.py17
-rw-r--r--lib/python/Plugins/Extensions/WebInterface/web-data/Makefile.am3
-rw-r--r--lib/python/Plugins/Extensions/WebInterface/web/Makefile.am4
-rw-r--r--lib/python/Plugins/Extensions/WebInterface/web/index.xml (renamed from lib/python/Plugins/Extensions/WebInterface/test.xml)0
-rw-r--r--lib/python/Plugins/Extensions/WebInterface/webif.py4
6 files changed, 24 insertions, 9 deletions
diff --git a/lib/python/Plugins/Extensions/WebInterface/Makefile.am b/lib/python/Plugins/Extensions/WebInterface/Makefile.am
index 7ea6391d..e69de29b 100644
--- a/lib/python/Plugins/Extensions/WebInterface/Makefile.am
+++ b/lib/python/Plugins/Extensions/WebInterface/Makefile.am
@@ -1,5 +0,0 @@
-installdir = $(LIBDIR)/enigma2/python/Plugins/Extensions/WebInterface
-
-install_PYTHON = \
- __init__.py \
- plugin.py webif.py *.xml
diff --git a/lib/python/Plugins/Extensions/WebInterface/plugin.py b/lib/python/Plugins/Extensions/WebInterface/plugin.py
index 84a82331..cc9a546b 100644
--- a/lib/python/Plugins/Extensions/WebInterface/plugin.py
+++ b/lib/python/Plugins/Extensions/WebInterface/plugin.py
@@ -5,18 +5,30 @@ sessions = [ ]
def startWebserver():
from twisted.internet import reactor
from twisted.web2 import server, http, static, resource, stream, http_headers, responsecode
+ from twisted.python import util
import webif
class ScreenPage(resource.Resource):
+ def __init__(self, path):
+ self.path = path
+
def render(self, req):
global sessions
if sessions == [ ]:
return http.Response(200, stream="please wait until enigma has booted")
s = stream.ProducerStream()
- webif.renderPage(s, req, sessions[0]) # login?
+ webif.renderPage(s, self.path, sessions[0]) # login?
return http.Response(stream=s)
+ def locateChild(self, request, segments):
+ path = '/'.join(["web"] + segments)
+ if path[-1:] == "/":
+ path += "index"
+
+ path += ".xml"
+ return ScreenPage(path), ()
+
class Toplevel(resource.Resource):
addSlash = True
@@ -24,8 +36,9 @@ def startWebserver():
return http.Response(responsecode.OK, {'Content-type': http_headers.MimeType('text', 'html')},
stream='Hello! you want probably go to <a href="/test">the test</a> instead.')
- child_test = ScreenPage() # "/test"
+ child_web = ScreenPage("/") # "/web"
child_hdd = static.File("/hdd")
+ child_webdata = static.File(util.sibpath(__file__, "web-data"))
site = server.Site(Toplevel())
diff --git a/lib/python/Plugins/Extensions/WebInterface/web-data/Makefile.am b/lib/python/Plugins/Extensions/WebInterface/web-data/Makefile.am
new file mode 100644
index 00000000..7b3caf9b
--- /dev/null
+++ b/lib/python/Plugins/Extensions/WebInterface/web-data/Makefile.am
@@ -0,0 +1,3 @@
+installdir = $(LIBDIR)/enigma2/python/Plugins/Extensions/WebInterface/web-data/
+
+install_PYTHON =
diff --git a/lib/python/Plugins/Extensions/WebInterface/web/Makefile.am b/lib/python/Plugins/Extensions/WebInterface/web/Makefile.am
new file mode 100644
index 00000000..2dd9b809
--- /dev/null
+++ b/lib/python/Plugins/Extensions/WebInterface/web/Makefile.am
@@ -0,0 +1,4 @@
+installdir = $(LIBDIR)/enigma2/python/Plugins/Extensions/WebInterface/web/
+
+install_PYTHON = *.xml
+
diff --git a/lib/python/Plugins/Extensions/WebInterface/test.xml b/lib/python/Plugins/Extensions/WebInterface/web/index.xml
index e69de29b..e69de29b 100644
--- a/lib/python/Plugins/Extensions/WebInterface/test.xml
+++ b/lib/python/Plugins/Extensions/WebInterface/web/index.xml
diff --git a/lib/python/Plugins/Extensions/WebInterface/webif.py b/lib/python/Plugins/Extensions/WebInterface/webif.py
index 6025a2e2..3bbc28dd 100644
--- a/lib/python/Plugins/Extensions/WebInterface/webif.py
+++ b/lib/python/Plugins/Extensions/WebInterface/webif.py
@@ -174,12 +174,12 @@ def lreduce(list):
string = None
return res
-def renderPage(stream, req, session):
+def renderPage(stream, path, session):
handler = webifHandler(session)
parser = make_parser()
parser.setFeature(feature_namespaces, 0)
parser.setContentHandler(handler)
- parser.parse(open(util.sibpath(__file__, 'test.xml'))) # currently fixed
+ parser.parse(open(util.sibpath(__file__, path)))
for x in lreduce(handler.res):
stream.write(str(x))
stream.finish() # must be done, unless we "callLater"