當前位置: 首頁>>代碼示例>>Python>>正文


Python html.PRE屬性代碼示例

本文整理匯總了Python中gluon.html.PRE屬性的典型用法代碼示例。如果您正苦於以下問題:Python html.PRE屬性的具體用法?Python html.PRE怎麽用?Python html.PRE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在gluon.html的用法示例。


在下文中一共展示了html.PRE屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_PRE

# 需要導入模塊: from gluon import html [as 別名]
# 或者: from gluon.html import PRE [as 別名]
def test_PRE(self):
        self.assertEqual(PRE('<>', _a='1', _b='2').xml(),
                         b'<pre a="1" b="2">&lt;&gt;</pre>') 
開發者ID:HackPucBemobi,項目名稱:touch-pay-client,代碼行數:5,代碼來源:test_html.py

示例2: data_select

# 需要導入模塊: from gluon import html [as 別名]
# 或者: from gluon.html import PRE [as 別名]
def data_select(self):
        """get selection by filter of current request """

        request = current.request

        filter = self.search_form.build_queries()


        if request.vars.cmd == 'get-records':
            offset = int(request.vars.offset)
            limit = int(request.vars.limit)
            limitby = (offset, offset + limit)
        else:
            limitby = None


        # self.selection = DalView(
        # rows = grand_select( -- deprecate grand_select naming
        rows = select_with_virtuals(
                        self.recid, *self.columns,
                        query=filter.query, having=filter.having,

                         # group order distinct
                         orderby=self.data_get_w2ui_orderby(),
                         limitby=limitby,
                         # **self.kwargs # translator inside
                         # left_join_chains=self.left_join_chains,
                         **self.dalview # translator and left and left_join_chains inside
                         )

        if hasattr(current, 'DBG') and current.DBG:
            # from helpers import tidy_SQL
            # current.session.sql_log = map(tidy_SQL, rows.sql_log)
            current.session.sql_log =  PRE( rows.sql_log )
            current.session.sql_log_nontranslated = PRE( rows.sql_nontranslated_log )

        # rows = self.selection.execute()

        return rows 
開發者ID:dz0,項目名稱:web2py_grand_helpers,代碼行數:41,代碼來源:plugin_GrandRegister.py

示例3: tidy_SQL

# 需要導入模塊: from gluon import html [as 別名]
# 或者: from gluon.html import PRE [as 別名]
def tidy_SQL(sql, wrap_PRE=True):
    for w in 'from left join inner where group limit COALESCE'.upper().split():
        sql = sql.replace(w, '\n' + w)

    sql = sql.replace('LEFT \n\nJOIN', 'LEFT JOIN')
    sql = sql.replace('LEFT \nJOIN', 'LEFT JOIN')

    sql = sql.replace('AND', '\n      AND')
    sql = sql.replace('OR', '\n      OR')

    if wrap_PRE: sql = PRE(sql)
    else: sql = "\n %s \n" % sql

    return sql 
開發者ID:dz0,項目名稱:web2py_grand_helpers,代碼行數:16,代碼來源:plugin_grand_helpers.py

示例4: toolbar

# 需要導入模塊: from gluon import html [as 別名]
# 或者: from gluon.html import PRE [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

示例5: toolbar

# 需要導入模塊: from gluon import html [as 別名]
# 或者: from gluon.html import PRE [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

示例6: toolbar

# 需要導入模塊: from gluon import html [as 別名]
# 或者: from gluon.html import PRE [as 別名]
def toolbar(self):
        from html import DIV, SCRIPT, BEAUTIFY, TAG, URL, 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:StuffShare,項目名稱:StuffShare,代碼行數:49,代碼來源:globals.py


注:本文中的gluon.html.PRE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。