• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python livepage.handler函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nevow.livepage.handler函数的典型用法代码示例。如果您正苦于以下问题:Python handler函数的具体用法?Python handler怎么用?Python handler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了handler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_handlerWithArgs

    def test_handlerWithArgs(self):
        options = [
            dict(bubble=True, outsideAttribute=True),
            dict(bubble=False, outsideAttribute=True),
            dict(bubble=False, outsideAttribute=False),
            dict(bubble=True, outsideAttribute=False),
        ]

        for opts in options:
            if opts["bubble"]:
                postlude = ""
            else:
                postlude = livepage.handledEventPostlude

            self.assertEquals(
                self.flt(livepage.handler(argsHandler, "hello", **opts)),
                livepage.ctsTemplate % (fakeId, ",'hello'", postlude),
            )

            self.assertEquals(
                self.flt(livepage.handler(argsHandler, "'", **opts)),
                livepage.ctsTemplate % (fakeId, ",'\\''", postlude),
            )

            self.assertEquals(
                self.flt(livepage.handler(argsHandler, "\\", **opts)),
                livepage.ctsTemplate % (fakeId, ",'\\\\'", postlude),
            )

            self.assertEquals(
                self.flt(livepage.handler(argsHandler, "\n", **opts)),
                livepage.ctsTemplate % (fakeId, ",'\\n'", postlude),
            )
开发者ID:RichDijk,项目名称:eXe,代码行数:33,代码来源:test_livepage.py


示例2: test_handlerWithIdentifier

    def test_handlerWithIdentifier(self):
        lp = self.livepage
        gatherer = self.livepage = LiveGatherer()

        self.flt(livepage.handler(oneHandler, identifier='same'))
        gatherer.handleInput('--handler-same')
        self.assertEquals(gatherer.heard, ['one'])

        self.flt(livepage.handler(twoHandler, identifier='same'))
        gatherer.handleInput('--handler-same')
        self.assertEquals(gatherer.heard, ['one', 'two'])

        self.livepage = lp
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:13,代码来源:test_livepage.py


示例3: test_handlerWithIdentifier

    def test_handlerWithIdentifier(self):
        gatherer = LiveGatherer()
        ctx = context.WovenContext()
        ctx.remember(gatherer, livepage.IClientHandle)

        oneQual = util.qual(oneHandler)
        twoQual = util.qual(twoHandler)

        ## Subscribe both handlers to the same identifier
        livepage.handler(oneHandler, identifier="same")(ctx, None)
        livepage.handler(twoHandler, identifier="same")(ctx, None)

        gatherer.handleInput("same")

        self.assertEquals(gatherer.heard, ["one", "two"])
开发者ID:RichDijk,项目名称:eXe,代码行数:15,代码来源:test_livepage.py


示例4: action_submit

 def action_submit(self, action, target, parameter):
     def observeSubmission(client):
         self.passed()
     return self.action_post(action, target, parameter, self._handle.flt([
         "function() {",
             livepage.handler(observeSubmission),
         "}"], quote=False))
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:7,代码来源:livetest.py


示例5: setUpHandler

 def setUpHandler(func, name, *args, **kwargs):
     """
     Convience function link funcs to hander ids
     and store them
     """
     kwargs['identifier'] = name
     hndlr = handler(func, *args, **kwargs)
     hndlr(ctx, client) # Stores it
开发者ID:giorgil2,项目名称:eXe,代码行数:8,代码来源:mainpage.py


示例6: action_click

 def action_click(self, action, target, parameter):
     def observeClicking(client):
         self.passed()
     return [
         "var theClickObservation = function() {",
         livepage.handler(observeClicking), "};",
         js.sendClickEvent(
             target,
             js.theClickObservation)]
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:9,代码来源:livetest.py


示例7: test_closedOverHandler

    def test_closedOverHandler(self):
        closedOver = "hello"

        def closuredHandler(client):
            client.sendScript(closedOver)

        ## We have to "render" the result because the event handler has to be
        ## subscribed to at render time.
        result = livepage.handler(closuredHandler)(self.ctx, None)
        ## The closured handler will have been assigned a unique id.
        self.assertEquals(result.content, livepage.ctsTemplate % (fakeId, "", livepage.handledEventPostlude))

        self.livepage.handleInput(fakeId)
        self.assertEquals(self.livepage.sent, "hello")
开发者ID:RichDijk,项目名称:eXe,代码行数:14,代码来源:test_livepage.py


示例8: action_follow

 def action_follow(self, action, target, parameter):
     def observeFollowing(client, location, destination):
         if location.endswith(destination):
             self.passed()
         else:
             self.failed()
     return [
         "var theTargetNode = ",
         contentDocument.getElementById(target), ";",
         "var theDestinationAddress = theTargetNode.href;",
         "addLoadObserver(function() {",
         livepage.handler(
             observeFollowing,
             contentDocument.location,
             js.theDestinationAddress),
         "});",
         js.setContentLocation(js.theDestinationAddress)]
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:17,代码来源:livetest.py


示例9: action_post

 def action_post(self, action, target, parameter, callWhenDone=None):
     if callWhenDone is None:
         callWhenDone = "function (){}"
     def observePosting(client, location, destination):
         if location.endswith(destination):
             self.passed()
         else:
             self.failed()
     return [
         "var targetForm = ", contentDocument[target], ";",
         "var postTarget = ", js.targetForm.action, ";",
         [(js.targetForm[key].value, ' = "', value, '";')
         for (key, value) in parameter.items()],
         "addLoadObserver(function () {",
         livepage.handler(
             observePosting,
             contentDocument.location,
             js.postTarget),
         "});",
         js.sendSubmitEvent(js.targetForm, js(callWhenDone))]
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:20,代码来源:livetest.py


示例10: test_decoratorLike

 def test_decoratorLike(self):
     decorator = livepage.handler(livepage.document)
     self.assertEquals(
         self.flt(decorator(argsHandler)),
         livepage.ctsTemplate % (fakeId, ",document", livepage.handledEventPostlude),
     )
开发者ID:RichDijk,项目名称:eXe,代码行数:6,代码来源:test_livepage.py


示例11: test_bubble

 def test_bubble(self):
     self.assertEquals(self.flt(livepage.handler(onClick, bubble=True)), livepage.ctsTemplate % (fakeId, "", ""))
开发者ID:RichDijk,项目名称:eXe,代码行数:2,代码来源:test_livepage.py


示例12: render_addChild

 def render_addChild(self, ctx, data):
     """Fills in the oncommand handler for the 
     add child button and short cut key"""
     return ctx.tag(oncommand=handler(self.outlinePane.handleAddChild,
                    js('currentOutlineId()')))
开发者ID:giorgil2,项目名称:eXe,代码行数:5,代码来源:mainpage.py


示例13: render_delNode

 def render_delNode(self, ctx, data):
     """Fills in the oncommand handler for the 
     delete child button and short cut key"""
     return ctx.tag(oncommand=handler(self.outlinePane.handleDelNode,
                    js("confirmDelete()"),
                    js('currentOutlineId()')))
开发者ID:giorgil2,项目名称:eXe,代码行数:6,代码来源:mainpage.py


示例14: test_handler

 def test_handler(self):
     result = livepage.handler(onClick)
     self.assertEquals(self.flt(result), livepage.ctsTemplate % (fakeId, "", livepage.handledEventPostlude))
     self.livepage.handleInput(fakeId)
     self.assertEquals(self.livepage.sent, "null;")
开发者ID:RichDijk,项目名称:eXe,代码行数:5,代码来源:test_livepage.py


示例15: _passHandle

 def _passHandle(self, ctx, name):
     """Ties up a handler for the promote, demote,
     up and down buttons. (Called by below funcs)"""
     attr = getattr(self.outlinePane, 'handle%s' % name)
     return ctx.tag(oncommand=handler(attr, js('currentOutlineId()')))
开发者ID:giorgil2,项目名称:eXe,代码行数:5,代码来源:mainpage.py



注:本文中的nevow.livepage.handler函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python livepage.js函数代码示例发布时间:2022-05-27
下一篇:
Python inevow.IRequest类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap