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


Python html.A属性代码示例

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


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

示例1: search_form_nongrand_inject_ajax

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import A [as 别名]
def search_form_nongrand_inject_ajax(self, context):
        # for dbg purposes
        # if not self.search.use_grand_search_form:

            ajax_url = "javascript:ajax('%s', %s, 'w2ui_records'); " % (
                URL(vars=dict(_grid=True, _w2ui_dbg=True), extension=None),
                [f.name for f in self.search_form.formfields_flat]
            )

            ajax_link = A('ajax load records', _href=ajax_url, _id="ajax_loader_link")
            ajax_result_target = DIV( "...AJAX RECORDS target...", _id='w2ui_records')

            context['form'] = CAT(ajax_result_target, ajax_link,
                                  context['form'] ,
                                  CAT("fast_filters", self.search.fast_filters)
                                  )

            return context 
开发者ID:dz0,项目名称:web2py_grand_helpers,代码行数:20,代码来源:plugin_GrandRegister.py

示例2: represent

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import A [as 别名]
def represent(cls, field, value, download_url=None):
        """
        How to represent the file:

        - with download url and if it is an image: <A href=...><IMG ...></A>
        - otherwise with download url: <A href=...>file</A>
        - otherwise: file

        Args:
            field: the field
            value: the field value
            download_url: url for the file download (default = None)
        """

        inp = current.T(cls.GENERIC_DESCRIPTION)

        if download_url and value:
            if callable(download_url):
                url = download_url(value)
            else:
                url = download_url + '/' + value
            if cls.is_image(value):
                inp = IMG(_src=url, _width=cls.DEFAULT_WIDTH)
            inp = A(inp, _href=url)

        return inp 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:28,代码来源:sqlhtml.py

示例3: test_A

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import A [as 别名]
def test_A(self):
        self.assertEqual(A('<>', _a='1', _b='2').xml(),
                         b'<a a="1" b="2">&lt;&gt;</a>')
        self.assertEqual(A('a', cid='b').xml(),
                         b'<a data-w2p_disable_with="default" data-w2p_method="GET" data-w2p_target="b">a</a>')
        self.assertEqual(A('a', callback='b', _id='c').xml(),
                         b'<a data-w2p_disable_with="default" data-w2p_method="POST" href="b" id="c">a</a>')
        # Callback with no id trigger web2py_uuid() call
        from gluon.html import web2pyHTMLParser
        #a = A('a', callback='b').xml()

        #for tag in web2pyHTMLParser(a).tree.elements('a'):
        #    uuid_generated = tag.attributes['_id']
        #self.assertEqual(a,
        #                 b'<a data-w2p_disable_with="default" data-w2p_method="POST" href="b" id="{id}">a</a>'.format(id=uuid_generated))
        self.assertEqual(A('a', delete='tr').xml(),
                         b'<a data-w2p_disable_with="default" data-w2p_remove="tr">a</a>')
        self.assertEqual(A('a', _id='b', target='<self>').xml(),
                         b'<a data-w2p_disable_with="default" data-w2p_target="b" id="b">a</a>')
        self.assertEqual(A('a', component='b').xml(),
                         b'<a data-w2p_disable_with="default" data-w2p_method="GET" href="b">a</a>')
        self.assertEqual(A('a', _id='b', callback='c', noconfirm=True).xml(),
                         b'<a data-w2p_disable_with="default" data-w2p_method="POST" href="c" id="b">a</a>')
        self.assertEqual(A('a', cid='b').xml(),
                         b'<a data-w2p_disable_with="default" data-w2p_method="GET" data-w2p_target="b">a</a>')
        self.assertEqual(A('a', cid='b', _disable_with='processing...').xml(),
                         b'<a data-w2p_disable_with="processing..." data-w2p_method="GET" data-w2p_target="b">a</a>')
        self.assertEqual(A('a', callback='b', delete='tr', noconfirm=True, _id='c').xml(),
                         b'<a data-w2p_disable_with="default" data-w2p_method="POST" data-w2p_remove="tr" href="b" id="c">a</a>')
        self.assertEqual(A('a', callback='b', delete='tr', confirm='Are you sure?', _id='c').xml(),
                         b'<a data-w2p_confirm="Are you sure?" data-w2p_disable_with="default" data-w2p_method="POST" data-w2p_remove="tr" href="b" id="c">a</a>') 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:33,代码来源:test_html.py

示例4: test_Adata

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import A [as 别名]
def test_Adata(self):
        self.assertEqual(A('<>', data=dict(abc='<def?asd>', cde='standard'), _a='1', _b='2').xml(),
                         b'<a a="1" b="2" data-abc="&lt;def?asd&gt;" data-cde="standard">&lt;&gt;</a>') 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:5,代码来源:test_html.py

示例5: widget

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import A [as 别名]
def widget(cls, field, value, download_url=None, **attributes):
        """
        generates a INPUT file tag.

        Optionally provides an A link to the file, including a checkbox so
        the file can be deleted.

        All is wrapped in a DIV.

        see also: `FormWidget.widget`

        Args:
            field: the field
            value: the field value
            download_url: url for the file download (default = None)
        """

        default = dict(_type='file', )
        attr = cls._attributes(field, default, **attributes)

        inp = INPUT(**attr)

        if download_url and value:
            if callable(download_url):
                url = download_url(value)
            else:
                url = download_url + '/' + value
            (br, image) = ('', '')
            if UploadWidget.is_image(value):
                br = BR()
                image = IMG(_src=url, _width=cls.DEFAULT_WIDTH)

            requires = attr["requires"]
            if requires == [] or isinstance(requires, IS_EMPTY_OR):
                inp = DIV(inp,
                          SPAN('[',
                               A(current.T(
                                UploadWidget.GENERIC_DESCRIPTION), _href=url),
                               '|',
                               INPUT(_type='checkbox',
                                     _name=field.name + cls.ID_DELETE_SUFFIX,
                                     _id=field.name + cls.ID_DELETE_SUFFIX),
                               LABEL(current.T(cls.DELETE_FILE),
                                     _for=field.name + cls.ID_DELETE_SUFFIX,
                                     _style='display:inline'),
                               ']', _style='white-space:nowrap'),
                          br, image)
            else:
                inp = DIV(inp,
                          SPAN('[',
                               A(current.T(cls.GENERIC_DESCRIPTION), _href=url),
                               ']', _style='white-space:nowrap'),
                          br, image)
        return inp 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:56,代码来源:sqlhtml.py

示例6: toolbar

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import A [as 别名]
def toolbar(self):
        from gluon.html import DIV, SCRIPT, BEAUTIFY, TAG, A
        BUTTON = TAG.button
        admin = URL("admin", "default", "design", extension='html',
                    args=current.request.application)
        from gluon.dal import DAL
        dbstats = []
        dbtables = {}
        infos = DAL.get_instances()
        for k, v in iteritems(infos):
            dbstats.append(TABLE(*[TR(PRE(row[0]), '%.2fms' % (row[1]*1000))
                                   for row in v['dbstats']]))
            dbtables[k] = dict(defined=v['dbtables']['defined'] or '[no defined tables]',
                               lazy=v['dbtables']['lazy'] or '[no lazy tables]')
        u = web2py_uuid()
        backtotop = A('Back to top', _href="#totop-%s" % u)
        # Convert lazy request.vars from property to Storage so they
        # will be displayed in the toolbar.
        request = copy.copy(current.request)
        request.update(vars=current.request.vars,
                       get_vars=current.request.get_vars,
                       post_vars=current.request.post_vars)
        return DIV(
            BUTTON('design', _onclick="document.location='%s'" % admin),
            BUTTON('request',
                   _onclick="jQuery('#request-%s').slideToggle()" % u),
            BUTTON('response',
                   _onclick="jQuery('#response-%s').slideToggle()" % u),
            BUTTON('session',
                   _onclick="jQuery('#session-%s').slideToggle()" % u),
            BUTTON('db tables',
                   _onclick="jQuery('#db-tables-%s').slideToggle()" % u),
            BUTTON('db stats',
                   _onclick="jQuery('#db-stats-%s').slideToggle()" % u),
            DIV(BEAUTIFY(request), backtotop,
                _class="w2p-toolbar-hidden", _id="request-%s" % u),
            DIV(BEAUTIFY(current.session), backtotop,
                _class="w2p-toolbar-hidden", _id="session-%s" % u),
            DIV(BEAUTIFY(current.response), backtotop,
                _class="w2p-toolbar-hidden", _id="response-%s" % u),
            DIV(BEAUTIFY(dbtables), backtotop,
                _class="w2p-toolbar-hidden", _id="db-tables-%s" % u),
            DIV(BEAUTIFY(dbstats), backtotop,
                _class="w2p-toolbar-hidden", _id="db-stats-%s" % u),
            SCRIPT("jQuery('.w2p-toolbar-hidden').hide()"),
            _id="totop-%s" % u
        ) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:49,代码来源:globals.py

示例7: toolbar

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import A [as 别名]
def toolbar(self):
        from gluon.html import DIV, SCRIPT, BEAUTIFY, TAG, A
        BUTTON = TAG.button
        admin = URL("admin", "default", "design", extension='html',
                    args=current.request.application)
        from gluon.dal import DAL
        dbstats = []
        dbtables = {}
        infos = DAL.get_instances()
        for k, v in infos.iteritems():
            dbstats.append(TABLE(*[TR(PRE(row[0]), '%.2fms' % (row[1]*1000))
                                   for row in v['dbstats']]))
            dbtables[k] = dict(defined=v['dbtables']['defined'] or '[no defined tables]',
                               lazy=v['dbtables']['lazy'] or '[no lazy tables]')
        u = web2py_uuid()
        backtotop = A('Back to top', _href="#totop-%s" % u)
        # Convert lazy request.vars from property to Storage so they
        # will be displayed in the toolbar.
        request = copy.copy(current.request)
        request.update(vars=current.request.vars,
                       get_vars=current.request.get_vars,
                       post_vars=current.request.post_vars)
        return DIV(
            BUTTON('design', _onclick="document.location='%s'" % admin),
            BUTTON('request',
                   _onclick="jQuery('#request-%s').slideToggle()" % u),
            BUTTON('response',
                   _onclick="jQuery('#response-%s').slideToggle()" % u),
            BUTTON('session',
                   _onclick="jQuery('#session-%s').slideToggle()" % u),
            BUTTON('db tables',
                   _onclick="jQuery('#db-tables-%s').slideToggle()" % u),
            BUTTON('db stats',
                   _onclick="jQuery('#db-stats-%s').slideToggle()" % u),
            DIV(BEAUTIFY(request), backtotop,
                _class="w2p-toolbar-hidden", _id="request-%s" % u),
            DIV(BEAUTIFY(current.session), backtotop,
                _class="w2p-toolbar-hidden", _id="session-%s" % u),
            DIV(BEAUTIFY(current.response), backtotop,
                _class="w2p-toolbar-hidden", _id="response-%s" % u),
            DIV(BEAUTIFY(dbtables), backtotop,
                _class="w2p-toolbar-hidden", _id="db-tables-%s" % u),
            DIV(BEAUTIFY(dbstats), backtotop,
                _class="w2p-toolbar-hidden", _id="db-stats-%s" % u),
            SCRIPT("jQuery('.w2p-toolbar-hidden').hide()"),
            _id="totop-%s" % u
        ) 
开发者ID:lucadealfaro,项目名称:true_review_web2py,代码行数:49,代码来源:globals.py


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