当前位置: 首页>>代码示例>>Python>>正文


Python E.div方法代码示例

本文整理汇总了Python中lxml.html.builder.E.div方法的典型用法代码示例。如果您正苦于以下问题:Python E.div方法的具体用法?Python E.div怎么用?Python E.div使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lxml.html.builder.E的用法示例。


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

示例1: _build_html_header

# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import div [as 别名]
    def _build_html_header(self):
        '''Add banner and account links'''
        header = self.elements.header
        index_url = self.links.get(
            'index', self.handler.reverse_url('index'))

        header.append(E.div(
            E.a(self.meta.app_name, href=index_url, id='logo-link'),
            id='logo-wrapper'
        ))
开发者ID:chfoo,项目名称:wuff,代码行数:12,代码来源:html.py

示例2: serialize

# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import div [as 别名]
    def serialize(self, ctx, message):
        """Uses ``ctx.out_object``, ``ctx.out_header`` or ``ctx.out_error`` to
        set ``ctx.out_body_doc``, ``ctx.out_header_doc`` and
        ``ctx.out_document`` as an ``lxml.etree._Element instance``.

        Not meant to be overridden.
        """

        assert message in (self.REQUEST, self.RESPONSE)

        self.event_manager.fire_event('before_serialize', ctx)

        if ctx.out_stream is None:
            ctx.out_stream = StringIO()

        if ctx.out_error is not None:
            # All errors at this point must be Fault subclasses.
            inst = ctx.out_error
            cls = inst.__class__
            name = cls.get_type_name()

            ctx.out_document = E.div()
            from lxml import etree
            with etree.xmlfile(ctx.out_stream) as xf:
                retval = HtmlBase.HtmlMicroFormat() \
                                            .to_parent(ctx, cls, inst, xf, name)

        else:
            assert message is self.RESPONSE
            result_message_class = ctx.descriptor.out_message

            name = result_message_class.get_type_name()
            if ctx.descriptor.body_style == BODY_STYLE_WRAPPED:
                if self.ignore_wrappers:
                    ctx.out_object = ctx.out_object[0]
                    result_message = ctx.out_object
                    while result_message_class.Attributes._wrapper:
                        result_message_class = next(iter(
                                      result_message_class._type_info.values()))

                else:
                    result_message = result_message_class()

                    for i, attr_name in enumerate(
                                        result_message_class._type_info.keys()):
                        setattr(result_message, attr_name, ctx.out_object[i])

            else:
                result_message = ctx.out_object

            retval = self.incgen(ctx, result_message_class, result_message, name)

        self.event_manager.fire_event('after_serialize', ctx)

        return retval
开发者ID:jpunwin,项目名称:spyne,代码行数:57,代码来源:_base.py

示例3: add_field

# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import div [as 别名]
    def add_field(self, field):
        translate = self._handler.locale.translate
        wrapper = E.div()

        if field.label:
            wrapper.append(E.label(translate(field.label.text), FOR(field.id)))

        wrapper.append(lxml.html.fromstring(field()))

        if field.errors:
            error_wrapper = E.ul()
            wrapper.append(error_wrapper)

            for error in field.errors:
                error_wrapper.append(E.li(E.strong(str(error))))

        self._element.append(wrapper)
开发者ID:chfoo,项目名称:wuff,代码行数:19,代码来源:base.py

示例4: __init__

# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import div [as 别名]
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        footer = E.footer(role='contentinfo', id='layout-footer')
        content = E.main(role='main', id='layout-content')
        header = E.header(role='banner', id='layout-header')
        layout = E.div(header, content, footer, id='layout-wrapper')
        body = E.body(layout)
        head = E.head(prefix='og: http://ogp.me/ns#')
        html = E.html(head, body, dir='rtl' if self.locale.rtl else 'ltr')

        self.elements = Elements(html=html, head=head, body=body,
            layout=layout, header=header, content=content, footer=footer)
        self.meta = HTMLMeta()
        self.links = HTMLLinks()

        self.stylesheets = []
        self.scripts = []

        self.meta.app_name = self.handler.application.settings[
            'application_name']
开发者ID:chfoo,项目名称:wuff,代码行数:22,代码来源:html.py

示例5: index

# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import div [as 别名]
 def index(self):
     return E.div(
         E.p(E.a("Cards", href="/get_all_card")),
         E.p(E.a("Sip Buddies", href="/get_all_sip_buddy")),
         E.p(E.a("Extensions", href="/get_all_extension")),
     )
开发者ID:cemrecan,项目名称:a2billing-spyne,代码行数:8,代码来源:_base.py


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