mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-05 17:11:43 +00:00
Convert introweb.py over to MultiFormatPage
This commit is contained in:
parent
0581ce7270
commit
5a30bd6169
@ -1,16 +1,20 @@
|
|||||||
|
|
||||||
import time, os
|
import time, os
|
||||||
from nevow import rend, inevow
|
from nevow import rend
|
||||||
from nevow.static import File as nevow_File
|
from nevow.static import File as nevow_File
|
||||||
from nevow.util import resource_filename
|
from nevow.util import resource_filename
|
||||||
import allmydata
|
import allmydata
|
||||||
import json
|
import json
|
||||||
from allmydata import get_package_versions_string
|
from allmydata import get_package_versions_string
|
||||||
from allmydata.util import idlib
|
from allmydata.util import idlib
|
||||||
from allmydata.web.common import getxmlfile, get_arg, render_time
|
from allmydata.web.common import (
|
||||||
|
getxmlfile,
|
||||||
|
render_time,
|
||||||
|
MultiFormatPage,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class IntroducerRoot(rend.Page):
|
class IntroducerRoot(MultiFormatPage):
|
||||||
|
|
||||||
addSlash = True
|
addSlash = True
|
||||||
docFactory = getxmlfile("introducer.xhtml")
|
docFactory = getxmlfile("introducer.xhtml")
|
||||||
@ -25,13 +29,7 @@ class IntroducerRoot(rend.Page):
|
|||||||
for filen in os.listdir(static_dir):
|
for filen in os.listdir(static_dir):
|
||||||
self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))
|
self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))
|
||||||
|
|
||||||
def renderHTTP(self, ctx):
|
def render_JSON(self, req):
|
||||||
t = get_arg(inevow.IRequest(ctx), "t")
|
|
||||||
if t == "json":
|
|
||||||
return self.render_JSON(ctx)
|
|
||||||
return rend.Page.renderHTTP(self, ctx)
|
|
||||||
|
|
||||||
def render_JSON(self, ctx):
|
|
||||||
res = {}
|
res = {}
|
||||||
|
|
||||||
counts = {}
|
counts = {}
|
||||||
@ -110,4 +108,3 @@ class IntroducerRoot(rend.Page):
|
|||||||
ctx.fillSlots("version", s.version)
|
ctx.fillSlots("version", s.version)
|
||||||
ctx.fillSlots("service_name", s.service_name)
|
ctx.fillSlots("service_name", s.service_name)
|
||||||
return ctx.tag
|
return ctx.tag
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user