Пример #1
0
 def __init__(self, *a, **kw):
     super(ViewResource, self).__init__(*a, **kw)
     self.jsModules.mapping.update({
         u'Delicate.TagChooser':
         util.resource_filename('delicate.web',
                                'javascript/tagchooser.js'),
         u'Delicate.BookmarkList':
         util.resource_filename('delicate.web',
                                'javascript/bookmarklist.js'),
         u'Delicate.Visual':
         util.resource_filename('delicate.web',
                                'javascript/visual.js'),
         })
Пример #2
0
class progressBarGlue:
    
    _css = util.resource_filename('nevow.taglibrary', "progressBar.css")
    _js = util.resource_filename('nevow.taglibrary', "progressBar.js")
    
    fileCSS = static.Data(_css, 'text/css')
    fileJS = static.Data(_js, 'text/javascript')
    fileGlue = (
        t.link(rel='stylesheet', type_='text/css', href='/progressBar.css'),
        t.script(type_='text/javascript', src='/progressBar.js')
        )
    
    inlineCSS = t.style(type_='text/css')[ t.xml(file(_css).read()) ]
    inlineJS = t.inlineJS(file(_js).read())
    inlineGlue = inlineJS, inlineCSS
Пример #3
0
class tabbedPaneGlue:

    _css = util.resource_filename('nevow.taglibrary', "tabbedPane.css")
    _js = util.resource_filename('nevow', "js/Nevow/TagLibrary/TabbedPane.js")

    fileCSS = static.File(_css, 'text/css')
    fileJS = static.File(_js, 'text/javascript')
    fileGlue = (t.link(rel='stylesheet',
                       type='text/css',
                       href='/tabbedPane.css'),
                t.script(type='text/javascript', src='/tabbedPane.js'))

    inlineCSS = t.style(type_='text/css')[t.xml(file(_css).read())]
    inlineJS = t.inlineJS(file(_js).read())
    inlineGlue = inlineJS, inlineCSS
Пример #4
0
 def __init__(self, introducer_node):
     self.introducer_node = introducer_node
     self.introducer_service = introducer_node.getServiceNamed("introducer")
     rend.Page.__init__(self, introducer_node)
     static_dir = resource_filename("allmydata.web", "static")
     for filen in os.listdir(static_dir):
         self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))
Пример #5
0
class FormBuilder(rend.Page):
    implements(IFormBuilder)
    addSlash = True

    def __init__(self):
        rend.Page.__init__(self)
        self.clearForm()

    def configurable_formBuilder(self, ctx):
        return configurable.TypedInterfaceConfigurable(self)

    def configurable_dynamicForm(self, ctx):
        return self.builderCore

    def addElement(self, name, type):
        self.builderCore.addElement(name, type)

    def clearForm(self):
        self.builderCore = BuilderCore()

    docFactory = loaders.stan(
        T.html[T.head[T.title["Form builder!"]],
               T.style(type="text/css")[open(
                   util.resource_filename('formless', 'freeform-default.css')
               ).read()], T.body[T.h1["Welcome to form builder"],
                                 webform.renderForms('formBuilder'),
                                 T.h2["Here is your form:"],
                                 webform.renderForms('dynamicForm')]])
Пример #6
0
    def __init__(self, client, clock=None, now_fn=None):
        rend.Page.__init__(self, client)
        self.client = client
        self.now_fn = now_fn

        self.putChild("uri", URIHandler(client))
        self.putChild("cap", URIHandler(client))

        # handler for "/magic_folder" URIs
        self.putChild("magic_folder", magic_folder.MagicFolderWebApi(client))

        # Handler for everything beneath "/private", an area of the resource
        # hierarchy which is only accessible with the private per-node API
        # auth token.
        self.putChild("private", create_private_tree(client.get_auth_token))

        self.putChild("file", FileHandler(client))
        self.putChild("named", FileHandler(client))
        self.putChild("status", status.Status(client.get_history()))
        self.putChild("statistics", status.Statistics(client.stats_provider))
        static_dir = resource_filename("allmydata.web", "static")
        for filen in os.listdir(static_dir):
            self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))

        self.putChild("report_incident", IncidentReporter())
Пример #7
0
    def __init__(self, client, clock=None, now_fn=None):
        rend.Page.__init__(self, client)
        self.client = client
        # If set, clock is a twisted.internet.task.Clock that the tests
        # use to test ophandle expiration.
        self.child_operations = operations.OphandleTable(clock)
        self.now_fn = now_fn
        try:
            s = client.getServiceNamed("storage")
        except KeyError:
            s = None
        self.child_storage = storage.StorageStatus(s, self.client.nickname)

        self.child_uri = URIHandler(client)
        self.child_cap = URIHandler(client)

        # handler for "/magic_folder" URIs
        self.child_magic_folder = magic_folder.MagicFolderWebApi(client)

        self.child_file = FileHandler(client)
        self.child_named = FileHandler(client)
        self.child_status = status.Status(client.get_history())
        self.child_statistics = status.Statistics(client.stats_provider)
        static_dir = resource_filename("allmydata.web", "static")
        for filen in os.listdir(static_dir):
            self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))
Пример #8
0
    def __init__(self, client, clock=None, now_fn=None):
        rend.Page.__init__(self, client)
        self.client = client
        # If set, clock is a twisted.internet.task.Clock that the tests
        # use to test ophandle expiration.
        self.child_operations = operations.OphandleTable(clock)
        self.now_fn = now_fn
        try:
            s = client.getServiceNamed("storage")
        except KeyError:
            s = None
        self.child_storage = storage.StorageStatus(s, self.client.nickname)

        self.child_uri = URIHandler(client)
        self.child_cap = URIHandler(client)

        # handler for "/magic_folder" URIs
        self.child_magic_folder = magic_folder.MagicFolderWebApi(client)

        self.child_file = FileHandler(client)
        self.child_named = FileHandler(client)
        self.child_status = status.Status(client.get_history())
        self.child_statistics = status.Statistics(client.stats_provider)
        static_dir = resource_filename("allmydata.web", "static")
        for filen in os.listdir(static_dir):
            self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))
Пример #9
0
 def __init__(self, introducer_node):
     self.introducer_node = introducer_node
     self.introducer_service = introducer_node.getServiceNamed("introducer")
     rend.Page.__init__(self, introducer_node)
     static_dir = resource_filename("allmydata.web", "static")
     for filen in os.listdir(static_dir):
         self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))
Пример #10
0
 def __init__(self, testSuite):
     super(TestFramework, self).__init__()
     self.testSuite = testSuite
     self.children = {
         'livetest.css':
         static.File(
             util.resource_filename('nevow.livetrial', 'livetest.css')),
     }
Пример #11
0
 def __init__(self, original, options=None, otherOption=None):
     self.original = original
     if options is not None:
         self.options = options
     if otherOption is not None:
         self.otherOption = otherOption
     if self.template is None:
         self.template = loaders.xmlfile(util.resource_filename('formal',
             'html/SelectOtherChoice.html'))
Пример #12
0
 def __init__(self, original, options=None, otherOption=None):
     self.original = original
     if options is not None:
         self.options = options
     if otherOption is not None:
         self.otherOption = otherOption
     if self.template is None:
         self.template = loaders.xmlfile(util.resource_filename('formal',
             'html/SelectOtherChoice.html'))
Пример #13
0
class tabbedPaneGlue:
    """
    Record which holds information about the Javascript & CSS requirements
    of L{TabbedPane} and L{TabbedPaneFragment}.

    @type stylesheetPath: C{str}
    @ivar stylesheetPath: Filesystem path of the tabbed pane stylesheet.

    @type javascriptPath: C{str}
    @ivar javascriptPath: Filesystem path of the tabbed pane Javascript
    module.

    @type fileCSS: L{static.File}
    @ivar fileCSS: Resource which serves L{stylesheetPath}.

    @type fileJS: L{static.File}
    @ivar fileJS: Resource which serves L{javascriptPath}.

    @type fileGlue: Stan
    @ivar fileGlue: Stan which, when placed in the <head> of an HTML document,
    will include the required CSS & Javascript.

    @type inlineCSS: L{t.style}
    @ivar inlineCSS: <style> tag containing the tabbedpane CSS inline.

    @type inlineJS: L{t.script}
    @ivar inlineJS: <script> tag containing the tabbedpane Javascript inline.

    @type inlineGlue: Stan
    @ivar inlineGlue: A tuple of L{inlineCSS} and L{inlineJS}.
    """
    stylesheetPath = util.resource_filename('nevow', 'css/Nevow/TagLibrary/TabbedPane.css')
    javascriptPath = util.resource_filename('nevow', 'js/Nevow/TagLibrary/TabbedPane.js')

    fileCSS = static.File(stylesheetPath, 'text/css')
    fileJS = static.File(javascriptPath, 'text/javascript')
    fileGlue = (
        t.link(rel='stylesheet', type='text/css', href='/tabbedPane.css'),
        t.script(type='text/javascript', src='/tabbedPane.js')
        )

    inlineCSS = t.style(type_='text/css')[ t.xml(file(stylesheetPath).read()) ]
    inlineJS = t.inlineJS(file(javascriptPath).read())
    inlineGlue = inlineJS, inlineCSS
Пример #14
0
class Tester(livepage.LivePage):
    addSlash = True
    child_css = static.File(util.resource_filename('nevow', 'livetest.css'))
    child_scripts = static.File(util.resource_filename('nevow', 'livetest.js'))
    child_postscripts = static.File(util.resource_filename('nevow', 'livetest-postscripts.js'))
    docFactory = loaders.stan(tags.html[
        tags.head[
            tags.script(src="scripts"),
            tags.link(rel="stylesheet", type="text/css", href="css")],
        tags.body[
            tags.table(id="testprogress")[
                tags.tr[
                    tags.th["Tests"], tags.th["Pass"], tags.th["Fail"]],
                tags.tr[
                    tags.td(id="test-status")["Running"],
                    tags.td(id="test-passes", _class="test-passes")[entities.nbsp],
                    tags.td(id="test-failures", _class="test-failures")[entities.nbsp]]],
            tags.table(id="testresults", render=tags.directive('sequence'))[
                tags.tr(pattern="item", render=tags.directive('test'))[
                    tags.td(title=tags.slot('action'))[tags.slot('action')],
                    tags.td(title=tags.slot('target'))[tags.slot('target')],
                    tags.td(title=tags.slot('parameter'))[tags.slot('parameter')]]],
            tags.iframe(id="testframe", src="asdf"),
            tags.script(src="postscripts"),
            livepage.glue]])

    def beforeRender(self, ctx):
        self.testId = 0

    def render_test(self, ctx, test):
        ctx.tag(id=("test-", self.testId))
        action, target, parameter = test
        ctx.fillSlots('action', action)
        ctx.fillSlots('target', str(target))
        ctx.fillSlots('parameter', str(parameter))
        self.testId += 1
        return ctx.tag

    def goingLive(self, ctx, handle):
        Driver(handle, self.original)
Пример #15
0
class DefaultSkin(rend.Page):
    implements(iskin.ISkin)

    docFactory = loaders.xmlfile(
        util.resource_filename('ldaptor.apps.webui', 'skin-default.html'))

    stylesheets = [
        'form.css',
        'ldaptor.css',
    ]

    def locateChild(self, ctx, segments):
        if segments[0] == 'form.css':
            return webform.defaultCSS, segments[1:]
        if segments[0] == 'ldaptor.css':
            dirname = os.path.abspath(os.path.dirname(__file__))
            return (static.File(os.path.join(dirname,
                                             'ldaptor.css')), segments[1:])
        else:
            return None, ()

    def render_title(self, ctx, data):
        return ctx.tag.clear()[self.original.resource.title]

    def render_head(self, ctx, data):
        def links(l, path=None):
            for filename in l:
                href = filename
                if path is not None:
                    href = path.child(href)
                yield tags.link(rel="stylesheet", type="text/css", href=href)

        ctx.tag.clear()
        stylesheets = getattr(self, 'stylesheets', None)
        if stylesheets is not None:
            ctx.tag[links(stylesheets, path=self.original.pathToFiles)]
        stylesheets = getattr(self.original.resource, 'stylesheets', None)
        if stylesheets is not None:
            ctx.tag[links(stylesheets)]
        return ctx.tag

    def render_content(self, ctx, data):
        return self.original.content
Пример #16
0
class tabbedPaneGlue:
    """
    Record which holds information about the Javascript & CSS requirements
    of L{TabbedPane} and L{TabbedPaneFragment}.

    @type stylesheetPath: C{str}
    @ivar stylesheetPath: Filesystem path of the tabbed pane stylesheet.

    @type fileCSS: L{static.File}
    @ivar fileCSS: Resource which serves L{stylesheetPath}.

    @type inlineCSS: L{t.style}
    @ivar inlineCSS: <style> tag containing the tabbedpane CSS inline.
    """
    stylesheetPath = util.resource_filename('nevow', 'css/Nevow/TagLibrary/TabbedPane.css')

    fileCSS = static.File(stylesheetPath, 'text/css')

    inlineCSS = t.style(type_='text/css')[ t.xml(file(stylesheetPath).read()) ]
Пример #17
0
 def locateChild(self, ctx, segments):
     if segments[0] == '_style':
         return (static.File(util.resource_filename(
             'eocmanage.webroot', 'style')),
                 segments[1:])
     elif segments[0] == '_freeform.css':
         return webform.defaultCSS, segments[1:]
     elif segments[0].startswith('_'):
         return None, ()
     elif '@' not in segments[0]:
         return None, ()
     else:
         ml = self.site.getList(segments[0])
         d = ml.exists()
         def cb(exists, ml):
             if exists:
                 return weblist.WebMailingList(list=ml), segments[1:]
             else:
                 return None, ()
         d.addCallback(cb, ml)
         return d
Пример #18
0
        if onload: self.onload = onload
        if onMouseMove: self.onMouseMove = onMouseMove
        if onMouseDown: self.onMouseDown = onMouseDown
        if onMouseUp: self.onMouseUp = onMouseUp
        if onKeyDown: self.onKeyDown = onKeyDown
        if onKeyUp: self.onKeyUp = onKeyUp

    def child_canvas_socket(self, ctx):
        return CanvasSocket()

    width = 1000
    height = 500

    onload = None
    onMouseDown = None
    onMouseUp = None
    onMouseMove = None
    onKeyUp = None
    onKeyDown = None

    def render_canvas(self, ctx, data):
        return canvas(
            self.width, self.height, self)

    docFactory = loaders.stan(tags.html[render_canvas])

setattr(Canvas, 'child_nevow_canvas_movie.swf', static.File(
    util.resource_filename('nevow', 'Canvas.swf'),
    'application/x-shockwave-flash'))

Пример #19
0
class Root(rend.Page):

    addSlash = True
    docFactory = getxmlfile("welcome.xhtml")

    def __init__(self, client, clock=None):
        rend.Page.__init__(self, client)
        self.client = client
        # If set, clock is a twisted.internet.task.Clock that the tests
        # use to test ophandle expiration.
        self.child_operations = operations.OphandleTable(clock)
        try:
            s = client.getServiceNamed("storage")
        except KeyError:
            s = None
        self.child_storage = storage.StorageStatus(s)

        self.child_uri = URIHandler(client)
        self.child_cap = URIHandler(client)

        self.child_file = FileHandler(client)
        self.child_named = FileHandler(client)
        self.child_status = status.Status(client.get_history())
        self.child_statistics = status.Statistics(client.stats_provider)

    def child_helper_status(self, ctx):
        # the Helper isn't attached until after the Tub starts, so this child
        # needs to created on each request
        return status.HelperStatus(self.client.helper)

    child_webform_css = webform.defaultCSS
    child_tahoe_css = nevow_File(resource_filename('allmydata.web', 'tahoe.css'))

    child_provisioning = provisioning.ProvisioningTool()
    if reliability.is_available():
        child_reliability = reliability.ReliabilityTool()
    else:
        child_reliability = NoReliability()

    child_report_incident = IncidentReporter()
    #child_server # let's reserve this for storage-server-over-HTTP

    # FIXME: This code is duplicated in root.py and introweb.py.
    def data_version(self, ctx, data):
        return get_package_versions_string()
    def data_import_path(self, ctx, data):
        return str(allmydata)
    def data_my_nodeid(self, ctx, data):
        return idlib.nodeid_b2a(self.client.nodeid)
    def data_my_nickname(self, ctx, data):
        return self.client.nickname

    def render_services(self, ctx, data):
        ul = T.ul()
        try:
            ss = self.client.getServiceNamed("storage")
            stats = ss.get_stats()
            if stats["storage_server.accepting_immutable_shares"]:
                msg = "accepting new shares"
            else:
                msg = "not accepting new shares (read-only)"
            available = stats.get("storage_server.disk_avail")
            if available is not None:
                msg += ", %s available" % abbreviate_size(available)
            ul[T.li[T.a(href="storage")["Storage Server"], ": ", msg]]
        except KeyError:
            ul[T.li["Not running storage server"]]

        if self.client.helper:
            stats = self.client.helper.get_stats()
            active_uploads = stats["chk_upload_helper.active_uploads"]
            ul[T.li["Helper: %d active uploads" % (active_uploads,)]]
        else:
            ul[T.li["Not running helper"]]

        return ctx.tag[ul]

    def data_introducer_furl(self, ctx, data):
        return self.client.introducer_furl
    def data_connected_to_introducer(self, ctx, data):
        if self.client.connected_to_introducer():
            return "yes"
        return "no"

    def data_helper_furl(self, ctx, data):
        try:
            uploader = self.client.getServiceNamed("uploader")
        except KeyError:
            return None
        furl, connected = uploader.get_helper_info()
        return furl
    def data_connected_to_helper(self, ctx, data):
        try:
            uploader = self.client.getServiceNamed("uploader")
        except KeyError:
            return "no" # we don't even have an Uploader
        furl, connected = uploader.get_helper_info()
        if connected:
            return "yes"
        return "no"

    def data_known_storage_servers(self, ctx, data):
        sb = self.client.get_storage_broker()
        return len(sb.get_all_serverids())

    def data_connected_storage_servers(self, ctx, data):
        sb = self.client.get_storage_broker()
        return len(sb.get_connected_servers())

    def data_services(self, ctx, data):
        sb = self.client.get_storage_broker()
        return sb.get_known_servers()

    def render_service_row(self, ctx, server):
        nodeid = server.get_serverid()

        ctx.fillSlots("peerid", server.longname())
        ctx.fillSlots("nickname", server.get_nickname())
        rhost = server.get_remote_host()
        if rhost:
            if nodeid == self.client.nodeid:
                rhost_s = "(loopback)"
            elif isinstance(rhost, address.IPv4Address):
                rhost_s = "%s:%d" % (rhost.host, rhost.port)
            else:
                rhost_s = str(rhost)
            connected = "Yes: to " + rhost_s
            since = server.get_last_connect_time()
        else:
            connected = "No"
            since = server.get_last_loss_time()
        announced = server.get_announcement_time()
        announcement = server.get_announcement()
        version = announcement["my-version"]
        service_name = announcement["service-name"]

        TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
        ctx.fillSlots("connected", connected)
        ctx.fillSlots("connected-bool", bool(rhost))
        ctx.fillSlots("since", time.strftime(TIME_FORMAT,
                                             time.localtime(since)))
        ctx.fillSlots("announced", time.strftime(TIME_FORMAT,
                                                 time.localtime(announced)))
        ctx.fillSlots("version", version)
        ctx.fillSlots("service_name", service_name)

        return ctx.tag

    def render_download_form(self, ctx, data):
        # this is a form where users can download files by URI
        form = T.form(action="uri", method="get",
                      enctype="multipart/form-data")[
            T.fieldset[
            T.legend(class_="freeform-form-label")["Download a file"],
            T.div["Tahoe-URI to download: ",
                  T.input(type="text", name="uri")],
            T.div["Filename to download as: ",
                  T.input(type="text", name="filename")],
            T.input(type="submit", value="Download!"),
            ]]
        return T.div[form]

    def render_view_form(self, ctx, data):
        # this is a form where users can download files by URI, or jump to a
        # named directory
        form = T.form(action="uri", method="get",
                      enctype="multipart/form-data")[
            T.fieldset[
            T.legend(class_="freeform-form-label")["View a file or directory"],
            "Tahoe-URI to view: ",
            T.input(type="text", name="uri"), " ",
            T.input(type="submit", value="View!"),
            ]]
        return T.div[form]

    def render_upload_form(self, ctx, data):
        # this is a form where users can upload unlinked files
        form = T.form(action="uri", method="post",
                      enctype="multipart/form-data")[
            T.fieldset[
            T.legend(class_="freeform-form-label")["Upload a file"],
            T.div["Choose a file: ",
                  T.input(type="file", name="file", class_="freeform-input-file")],
            T.input(type="hidden", name="t", value="upload"),
            T.div[T.input(type="checkbox", name="mutable"), T.label(for_="mutable")["Create mutable file"],
                  " ", T.input(type="submit", value="Upload!")],
            ]]
        return T.div[form]

    def render_mkdir_form(self, ctx, data):
        # this is a form where users can create new directories
        form = T.form(action="uri", method="post",
                      enctype="multipart/form-data")[
            T.fieldset[
            T.legend(class_="freeform-form-label")["Create a directory"],
            T.input(type="hidden", name="t", value="mkdir"),
            T.input(type="hidden", name="redirect_to_result", value="true"),
            T.input(type="submit", value="Create a directory"),
            ]]
        return T.div[form]

    def render_incident_button(self, ctx, data):
        # this button triggers a foolscap-logging "incident"
        form = T.form(action="report_incident", method="post",
                      enctype="multipart/form-data")[
            T.fieldset[
            T.legend(class_="freeform-form-label")["Report an Incident"],
            T.input(type="hidden", name="t", value="report-incident"),
            "What went wrong?: ",
            T.input(type="text", name="details"), " ",
            T.input(type="submit", value="Report!"),
            ]]
        return T.div[form]
        implements(inevow.IResource)

        def __init__(self, path, content_type='text/plain'):
            self.path = path
            self.content_type = content_type

        def locateChild(self, *args):
            from nevow import rend
            return rend.NotFound

        def renderHTTP(self, ctx):
            inevow.IRequest(ctx).setHeader('Content-type', self.content_type)
            return open(self.path).read()


defaultCSS = File(util.resource_filename('formless', 'freeform-default.css'),
                  'text/css')


class DefaultRenderer(object):
    implements(inevow.IRenderer, iformless.ITypedRenderer)
    complexType = False

    def rend(self, context, data):
        return StringRenderer(data)


defaultBindingRenderer = DefaultRenderer()


class BaseInputRenderer(components.Adapter):
Пример #21
0
def getxmlfile(name):
    return loaders.xmlfile(resource_filename("allmydata.web", "%s" % name))
Пример #22
0
 def __init__(self, testSuite):
     super(TestFramework, self).__init__()
     self.testSuite = testSuite
     self.children = {
         'livetest.css': static.File(util.resource_filename('nevow.livetrial', 'livetest.css')),
     }
Пример #23
0
        if onload: self.onload = onload
        if onMouseMove: self.onMouseMove = onMouseMove
        if onMouseDown: self.onMouseDown = onMouseDown
        if onMouseUp: self.onMouseUp = onMouseUp
        if onKeyDown: self.onKeyDown = onKeyDown
        if onKeyUp: self.onKeyUp = onKeyUp

    def child_canvas_socket(self, ctx):
        return CanvasSocket()

    width = 1000
    height = 500

    onload = None
    onMouseDown = None
    onMouseUp = None
    onMouseMove = None
    onKeyUp = None
    onKeyDown = None

    def render_canvas(self, ctx, data):
        return canvas(self.width, self.height, self)

    docFactory = loaders.stan(tags.html[render_canvas])


setattr(
    Canvas, 'child_nevow_canvas_movie.swf',
    static.File(util.resource_filename('nevow', 'Canvas.swf'),
                'application/x-shockwave-flash'))
Пример #24
0
        if onload: self.onload = onload
        if onMouseMove: self.onMouseMove = onMouseMove
        if onMouseDown: self.onMouseDown = onMouseDown
        if onMouseUp: self.onMouseUp = onMouseUp
        if onKeyDown: self.onKeyDown = onKeyDown
        if onKeyUp: self.onKeyUp = onKeyUp

    def child_canvas_socket(self, ctx):
        return CanvasSocket()

    width = 1000
    height = 500

    onload = None
    onMouseDown = None
    onMouseUp = None
    onMouseMove = None
    onKeyUp = None
    onKeyDown = None

    def render_canvas(self, ctx, data):
        return canvas(
            self.width, self.height, self)

    docFactory = loaders.stan(tags.html[render_canvas])

setattr(Canvas, 'child_nevow_canvas_movie.swf', static.File(
    util.resource_filename('nevow', 'Canvas.swf'),
    'application/x-shockwave-flash'))

Пример #25
0
from nevow import athena,util

myPackage = athena.JSPackage({
    'Numbler': util.resource_filename('numbler.js','myaccount.js'),
    })
Пример #26
0
from twisted.python import components

from nevow import inevow
from nevow.stan import slot
from nevow import tags
from nevow import util
from nevow.context import NodeNotFound

from formless import iformless
from formless.formutils import FormDefaults, FormErrors, calculatePostURL, keyToXMLID, getError


from nevow.static import File

defaultCSS = File(util.resource_filename("formless", "freeform-default.css"), "text/css")


@implementer(inevow.IRenderer, iformless.ITypedRenderer)
class DefaultRenderer(object):
    complexType = False

    def rend(self, context, data):
        return StringRenderer(data)


defaultBindingRenderer = DefaultRenderer()


@implementer(inevow.IRenderer, iformless.ITypedRenderer)
class BaseInputRenderer(components.Adapter):
Пример #27
0
def getxmlfile(name):
    return loaders.xmlfile(resource_filename('allmydata.web', '%s' % name))
Пример #28
0
 def child_timeline2(self, ctx):
     return File(resource_filename('allmydata.web', 'download-status-timeline2.xhtml'))
Пример #29
0
        else:
            handleId = 'null'

        return [
            tags.script(type="text/javascript")[
                "var nevow_clientHandleId = ", handleId ,";"],
            tags.script(type="text/javascript",
                        src=url.here.child('nevow_glue.js'))
            ]


setattr(
    LivePage,
    'child_nevow_glue.js',
    static.File(
        util.resource_filename('nevow', 'liveglue.js'),
        'text/javascript'))


glue = tags.directive('liveglue')




##### BACKWARDS COMPATIBILITY CODE


ctsTemplate = "nevow_clientToServerEvent('%s',this,''%s)%s"
handledEventPostlude = '; return false;'

Пример #30
0
 def childFactory(self, ctx, name):
     if name in self._javascript:
         return static.File(util.resource_filename('nevow', self._javascript[name]))
Пример #31
0
def getxmlfile(name):
    return loaders.xmlfile(resource_filename('allmydata.web', '%s' % name))
Пример #32
0
                self, self.refreshInterval,
                self.targetTimeoutCount).handleId, "'"
        else:
            handleId = 'null'

        return [
            tags.script(type="text/javascript")["var nevow_clientHandleId = ",
                                                handleId, ";"],
            tags.script(type="text/javascript",
                        src=url.here.child('nevow_glue.js'))
        ]


setattr(
    LivePage, 'child_nevow_glue.js',
    static.File(util.resource_filename('nevow', 'liveglue.js'),
                'text/javascript'))

glue = tags.directive('liveglue')

##### BACKWARDS COMPATIBILITY CODE

ctsTemplate = "nevow_clientToServerEvent('%s',this,''%s)%s"
handledEventPostlude = '; return false;'


class handler(object):
    callme = None
    args = ()
    identifier = None
Пример #33
0
 def f(name):
     return nevow_File(resource_filename('allmydata.web', name))
Пример #34
0
 def __init__(self, testSuite):
     super(TestFramework, self).__init__(None, None, jsModuleRoot=url.here.child('jsmodule'))
     self.testSuite = testSuite
     self.children = {
         'livetest.css': static.File(util.resource_filename('nevow.livetrial', 'livetest.css')),
     }
Пример #35
0
def loader(filename):
    return loaders.xmlfile(util.resource_filename('tub.apps.users.templates',
        filename), ignoreDocType=True)
Пример #36
0
 def __init__(self, package, filename, **k):
     super(PackageTemplate, self).__init__(util.resource_filename(package,
         filename), **k)
Пример #37
0
from twisted.python import components

from nevow import inevow
from nevow.stan import slot
from nevow import tags
from nevow import util
from nevow.context import NodeNotFound

from formless import iformless
from formless.formutils import FormDefaults, FormErrors, calculatePostURL, keyToXMLID, getError


from nevow.static import File

defaultCSS = File(util.resource_filename('formless', 'freeform-default.css'), 'text/css')


class DefaultRenderer(object):
    implements(inevow.IRenderer, iformless.ITypedRenderer)
    complexType = False
    def rend(self, context, data):
        return StringRenderer(data)

defaultBindingRenderer = DefaultRenderer()


class BaseInputRenderer(components.Adapter):
    implements(inevow.IRenderer, iformless.ITypedRenderer)
    complexType = False
    def rend(self, context, data):
Пример #38
0
    def removeClient(self, clientID):
        # State-tracking bugs may make it tempting to make the next line a
        # 'pop', but it really shouldn't be; if the Page instance with this
        # client ID is already gone, then it should be gone, which means that
        # this method can't be called with that argument.
        del self.clients[clientID]
        if self.noisy:
            log.msg("Disconnected old LivePage %r" % (clientID, ))

    def _newClientID(self):
        return guard._sessionCookie()


_thePrivateAthenaResource = static.File(
    util.resource_filename('nevow', 'athena_private'))


class ConnectFailed(Exception):
    pass


class ConnectionLost(Exception):
    pass


CLOSE = u'close'


class ReliableMessageDelivery(object):
    _paused = 0