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

Python loaders.xmlfile函数代码示例

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

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



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

示例1: template

def template(templatename, pattern=None):
    """
    Load XML template
    """
    return loaders.xmlfile(templatename, 
                           templateDir=config.TEMPLATE_PATH,
                           pattern=pattern)
开发者ID:j2a,项目名称:pyo-sandbox,代码行数:7,代码来源:pages.py


示例2: __init__

 def __init__(self, original, ctx, factory):
     self.factory = factory  
     self.user = self.factory.getUser(original)
     rend.Page.__init__(self, original)
     
     r = manager.ResourceManager()
     UserAdmin.docFactory = loaders.xmlfile( r["resources"]["web"]["user_admin.html"] )
开发者ID:aoupi,项目名称:pyscrabble-club,代码行数:7,代码来源:site.py


示例3: render_content

 def render_content(self, ctx, data):
     role = self.getRole(ctx)
     
     if role == 0:
         return self.renderAlert('You are not authorized')
     
     return loaders.xmlfile(webappPath('agent/index.html'))
开发者ID:myaut,项目名称:tsload,代码行数:7,代码来源:agent.py


示例4: getDocFactory

    def getDocFactory(self, fragmentName, default=None):
        """
        For a given fragment, return a loaded Nevow template.

        @param fragmentName: the name of the template (can include relative
        paths).

        @param default: a default loader; only used if provided and the
        given fragment name cannot be resolved.

        @return: A loaded Nevow template.
        @type return: L{nevow.loaders.xmlfile}
        """
        if fragmentName in self.cachedLoaders:
            return self.cachedLoaders[fragmentName]
        segments = fragmentName.split('/')
        segments[-1] += '.html'
        file = self.directory
        for segment in segments:
            file = file.child(segment)
        if file.exists():
            loader = xmlfile(file.path)
            self.cachedLoaders[fragmentName] = loader
            return loader
        return default
开发者ID:fusionapp,项目名称:mantissa,代码行数:25,代码来源:webtheme.py


示例5: test_docFactoryInStanTree

    def test_docFactoryInStanTree(self):

        class Page(rend.Page):

            def __init__(self, included):
                self.included = included
                rend.Page.__init__(self)

            def render_included(self, context, data):
                return self.included
            
            docFactory = loaders.stan(div[invisible(render=directive('included'))])

        doc = '<p>fum</p>'
        temp = self.mktemp()
        f = file(temp, 'w')
        f.write(doc)
        f.close()

        result = deferredRender(Page(loaders.stan(p['fee'])))
        self.assertEquals(result, '<div><p>fee</p></div>')
        result = deferredRender(Page(loaders.htmlstr('<p>fi</p>')))
        self.assertEquals(result, '<div><p>fi</p></div>')
        result = deferredRender(Page(loaders.xmlstr('<p>fo</p>')))
        self.assertEquals(result, '<div><p>fo</p></div>')
        result = deferredRender(Page(loaders.htmlfile(temp)))
        self.assertEquals(result, '<div><p>fum</p></div>')
        result = deferredRender(Page(loaders.xmlfile(temp)))
        self.assertEquals(result, '<div><p>fum</p></div>')
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:29,代码来源:test_rend.py


示例6: macro_content

 def macro_content(self, ctx):
     return t.invisible[
                t.p["This macro has been called ",
                    next(counter2)+1,
                    " time(s)"],
                loaders.xmlfile(util.sibpath(__file__,'child_macro.html'), ignoreDocType=True).load()
         ]
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:7,代码来源:macros.py


示例7: __init__

    def __init__(self, parent, package=None, webServer=None, name=None):
        """
        Pass me a 'parent' rendering component,
        a 'package' that I'm rendering for
        and a 'webServer' instance reference (from webServer.py)
        If you don't pass 'webServer' and 'package' I'll
        get them from 'parent'
        'name' is a identifier to distuniguish us from the other children of our
        parent
        """
        self.parent = parent # This is the same for both blocks and pages
        if name:
            self.name = name
        elif not self.name:
            raise AssertionError('Element of class "%s" created with no name.' %
                                 self.__class__.__name__)
            
        # Make pylint happy. These attributes will be gotten from
        # self.application
        self.config = Unset
        self.ideviceStore = Unset
        self.packageStore = Unset

        # Overwrite old instances with same name
        if parent:
            parent.renderChildren[self.name] = self
        self.renderChildren = {}
        if package:
            self.package = package
        elif parent:
            self.package = parent.package
        else:
            self.package = None
        if webServer:
            self.webServer = webServer
        elif parent:
            self.webServer = parent.webServer
        else:
            self.webServer = None
        if self._templateFileName:
            if hasattr(self, 'config') and self.config:
                pth = self.config.webDir/'templates'/self._templateFileName
                self.docFactory = loaders.xmlfile(pth)
            else:
                # Assume directory is included in the filename
                self.docFactory = loaders.xmlfile(self._templateFileName)
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:46,代码来源:renderable.py


示例8: test_xmlfile

 def test_xmlfile(self):
     doc = '<ul id="nav"><li>a</li><li>b</li><li>c</li></ul>'
     temp = self.mktemp()
     f = file(temp, 'w')
     f.write(doc)
     f.close()
     df = loaders.xmlfile(temp)
     self.assertEquals(df.load()[0], doc)
开发者ID:StetHD,项目名称:nevow,代码行数:8,代码来源:test_loaders.py


示例9: __init__

 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'))
开发者ID:nakedible,项目名称:vpnease-l2tp,代码行数:9,代码来源:widget.py


示例10: __init__

	def __init__(self, *args, **kwargs):
		zoto_base_page.__init__(self, *args, **kwargs)
		self.album_id = -1
		self.offset = 0
		self.username = args[0]
		self.album_id = args[1]
		self.can_view = False
		self.docFactory = loaders.xmlfile(os.path.join(self.tpl_path, "album_template.xml"))
		self.template_path = "%s/album_templates" % aztk_config.setup.get("paths", "web")
开发者ID:BGCX261,项目名称:zoto-server-svn-to-git,代码行数:9,代码来源:user_albums.py


示例11: test_xmlfilePreprocessors

 def test_xmlfilePreprocessors(self):
     """
     Test that the xmlstr loader properly passes uncompiled documents to
     preprocessors it is given.
     """
     xmlFile = self.mktemp()
     f = file(xmlFile, 'w')
     f.write('<div><span>Hello</span><span>world</span></div>')
     f.close()
     factory = loaders.xmlfile(xmlFile)
     return self._preprocessorTest(factory)
开发者ID:StetHD,项目名称:nevow,代码行数:11,代码来源:test_loaders.py


示例12: run

    def run(self):
        kwargs = {}
        template = self.get('template', None)
        if template is not None:
            kwargs['docFactory'] = loaders.xmlfile(template)

        feed = readFeed(self.path)
        a = Atom(feed, **kwargs)
        d = a.renderString()
        d.addCallback(self._print)
        return d
开发者ID:tv42,项目名称:atomat,代码行数:11,代码来源:import_.py


示例13: getfiles

    def getfiles(self,nodes):
        for node in nodes:
            if len(node) == 4:
                self.getfiles(node[3])

            try:
                newpage = rend.Page()
                newpage.docFactory = loaders.xmlfile(node[2],templateDir='apidoc')
            except Exception,e:
                pass
            else:
                self.children[node[1]] = newpage
开发者ID:comfuture,项目名称:numbler,代码行数:12,代码来源:apimanager.py


示例14: getHtml

def getHtml(yamlfile, countItems, template):
    ydata = list(yaml.loadFile(yamlfile))[0]
    Page.docFactory = loaders.xmlfile(template)

    d = Page(ydata, countItems).renderString()

    output = []
    d.addCallback(cb, output)
    d.addErrback(eb)
    reactor.run()

    return output[0]
开发者ID:BackupTheBerlios,项目名称:pbp-svn,代码行数:12,代码来源:news2html.py


示例15: test_xmlFileInStanTree

    def test_xmlFileInStanTree(self):
        """
        Like L{test_htmlStringInStanTree}, but for an xmlfile loader.
        """
        doc = '<p>I</p>'
        temp = self.mktemp()
        f = file(temp, 'w')
        f.write(doc)
        f.close()

        return self._testDocFactoryInStanTree(
            loaders.xmlfile(temp),
            '<p>I</p>')
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:13,代码来源:test_rend.py


示例16: workloadType

 def workloadType(self, ctx, wltypeName):
     session = inevow.ISession(ctx) 
     if self.workloadTypes is None:
         self.workloadTypes = yield session.agent.expsvcAgent.getWorkloadTypes(agentId = self.agentId)
     
     wltype = self.workloadTypes[wltypeName]
     
     wlcDescriptions = [T.li[wlclasses[wlc][1]]
                        for wlc 
                        in wltype.wlclass]
     
     ctx.fillSlots('name', wltypeName)
     ctx.fillSlots('module', wltype.module)
     ctx.fillSlots('path', wltype.path)
     ctx.fillSlots('classes', T.ul()[wlcDescriptions])
     
     self.data_workloadParams = []
     
     for paramName, param in wltype.params.iteritems():
                 if param.flags & TSWLParamCommon.WLPF_OPTIONAL:
                     paramName = T.span[paramName,
                                        T.sup['OPT']]
                 
                 wlpType = WLParamHelper.getTypeName(param)
                 
                 minVal, maxVal = WLParamHelper.getIntegerRange(param)
                 lenVal = WLParamHelper.getStringLength(param)
                 range = 'None'
                 
                 if minVal is not None and maxVal is not None:
                     range = '[%s...%s]' % (_wlparamToStr(minVal, param), 
                                            _wlparamToStr(maxVal, param))
                 elif lenVal is not None:
                     range = 'len: %s' % lenVal
                 
                 default = WLParamHelper.getDefaultValue(param)
                 if default is not None:
                     default = _wlparamToStr(default, param)
                 else:
                     default = 'None'
                 
                 self.data_workloadParams.append({'param': paramName, 
                                                  'type': wlpType, 
                                                  'range': range, 
                                                  'default': default, 
                                                  'description': param.description})
     
     wltparams = loaders.xmlfile(webappPath('agent/wltypeparam.html'))
     
     returnValue(wltparams)
开发者ID:myaut,项目名称:tsload,代码行数:50,代码来源:agent.py


示例17: renderHTTP

    def renderHTTP(self, ctx):
        """
        Check for a confirmation being used from the email link.

        If the user is confirming a login, move the password from
        unconfirmedPassword into password, thus enabling the account.
        """
        req = inevow.IRequest(ctx)
        confirm = req.args.get('confirm', None) 
        if confirm is not None:
            confirm = unicode(confirm[0])
            store = theGlobal['database']
            u = store.findFirst(data.User, data.User.confirmationKey==confirm)
            if u is not None:
                u.password = u.unconfirmedPassword
                u.unconfirmedPassword = None
                req.args.clear()
                self.docFactory = loaders.xmlfile(
                        RESOURCE('templates/confirmed.xhtml'))
            else:
                self.docFactory = loaders.stan(['Could not confirm that account.'])
        return super(SignupPage, self).renderHTTP(ctx)
开发者ID:BackupTheBerlios,项目名称:vellum-svn,代码行数:22,代码来源:signup.py


示例18: __init__

    def __init__(self, parent, package):
        """
        Initialize a new XUL page
        'package' is the package that we look after
        """
        self.name = package.name
        RenderableLivePage.__init__(self, parent, package)
        self.putChild("resources", static.File(package.resourceDir))

        mainxul = Path(self.config.xulDir).joinpath('templates', 'mainpage.xul')
        self.docFactory  = loaders.xmlfile(mainxul)

        # Create all the children on the left
        self.outlinePane = OutlinePane(self)
        self.idevicePane = IdevicePane(self)
        self.styleMenu   = StyleMenu(self)

        # And in the main section
        self.authoringPage  = AuthoringPage(self)
        self.propertiesPage = PropertiesPage(self)

        # translate the "don't close the window" message
        red_x = _("Please use eXe's\n   File... Quit\nmenu to close eXe.")
开发者ID:giorgil2,项目名称:eXe,代码行数:23,代码来源:mainpage.py


示例19: agentCommonInfo

 def agentCommonInfo(self, ctx):
     agentInfo = self.agentInfo
     clientInfo = self.clientInfo
     
     if clientInfo is None:
         clientStateImg = T.img(src = '/images/cl-status/dead.png')
         clientState = 'disconnected'
         
         clientId = 'N/A'
         clientUuid = 'N/A'
         clientEndpoint = 'N/A'
     else:
         clientStateImg = T.img(src = '/images/cl-status/established.png')
         clientState = 'established'
         
         clientId = clientInfo.id
         clientUuid = clientInfo.uuid
         clientEndpoint = clientInfo.endpoint
     
     for slot, data in [('hostname', agentInfo.hostname),
                         ('domainname', agentInfo.domainname),
                         ('osname', agentInfo.osname),
                         ('release', agentInfo.release),
                         ('arch', agentInfo.machineArch),
                         ('numCPUs', agentInfo.numCPUs),
                         ('numCores', agentInfo.numCores),
                         ('memTotal', agentInfo.memTotal),
                         ('agentId', agentInfo.agentId),
                         ('lastOnline', agentInfo.lastOnline),
                         ('clientStateImg', clientStateImg),
                         ('clientState', clientState),
                         ('clientId', clientId),
                         ('clientUuid', clientUuid),
                         ('clientEndpoint', clientEndpoint)]:
             ctx.fillSlots(slot, data)
         
     return loaders.xmlfile(webappPath('agent/loadinfoagent.html'))
开发者ID:myaut,项目名称:tsload,代码行数:37,代码来源:agent.py


示例20: docFactory

 def docFactory(self):
     return loaders.xmlfile(_tpl.path)
开发者ID:mattvonrocketstein,项目名称:cortex,代码行数:2,代码来源:alerts.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python loaders.xmlstr函数代码示例发布时间:2022-05-27
下一篇:
Python loaders.stan函数代码示例发布时间: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