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


Python html.URL属性代码示例

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


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

示例1: fast_tz_detector

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def fast_tz_detector():
    current.response.files.append(URL('static', 'plugin_timezone/jstz.min.js'))
    ##//cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js
    script = """
jQuery(document).on('plugin_timezone.fast_tz_detector', function (e) {
    var tz = jstz.determine();
    if (typeof (tz) !== 'undefined') {
        var name = tz.name()
        jQuery.post('%s', {timezone : name});
    }
});
jQuery(document).ready(function () {
    jQuery(this).trigger('plugin_timezone.fast_tz_detector');
});
""" % URL()
    if current.request.post_vars.timezone:
        if current.request.post_vars.timezone in TZDICT:
            if not current.session.plugin_timezone_tz:
                current.session.plugin_timezone_tz = current.request.post_vars.timezone

    return SCRIPT(script) 
开发者ID:lucadealfaro,项目名称:true_review,代码行数:23,代码来源:__init__.py

示例2: search_form_nongrand_inject_ajax

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [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

示例3: make_menu

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def make_menu(controller_dir, menuname=None, append=False):
    from gluon.html import URL

    test_functions = [x for x in controller_dir if x.startswith('test') and x!='tester']
    test_functions.sort()

    menu = [
                     (menuname or 'TESTS', False, '',
                        [
                            (f, f==current.request.function, URL(f) )
                            for f in test_functions
                        ]
                     ),
                     # ('populate auth tables', False, URL('populate_fake_auth') ),
                    ]
    if append and current.response.menu:
        current.response.menu.extend( menu )
    else:
        current.response.menu = menu
    return menu



# FOR TEST controllers 
开发者ID:dz0,项目名称:web2py_grand_helpers,代码行数:26,代码来源:plugin_grand_helpers.py

示例4: requires_https

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def requires_https(self):
        """
        If request comes in over HTTP, redirects it to HTTPS
        and secures the session.
        """
        cmd_opts = global_settings.cmd_options
        # checking if this is called within the scheduler or within the shell
        # in addition to checking if it's not a cronjob
        if ((cmd_opts and (cmd_opts.shell or cmd_opts.scheduler))
                or global_settings.cronjob or self.is_https):
            current.session.secure()
        else:
            current.session.forget()
            redirect(URL(scheme='https', args=self.args, vars=self.vars)) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:16,代码来源:globals.py

示例5: test_router_prefix

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_router_prefix(self):
        '''
        Test path_prefix
        '''
        router_path_prefix = dict(
            BASE=dict(
                default_application='a1',
                applications=['a1', 'a2'],
                path_prefix='/path/to/apps',
            ),
            a1=dict(
                controllers=['c1a', 'c1b', 'default'],
            ),
            a2=dict(
                default_controller='c2',
                controllers=[],
            ),
        )
        load(rdict=router_path_prefix)
        self.assertEqual(str(URL(a='a1', c='c1a', f='f')),
                         "/path/to/apps/c1a/f")
        self.assertEqual(str(URL(a='a2', c='c', f='f')),
                         "/path/to/apps/a2/c/f")
        self.assertEqual(str(URL(a='a2', c='c2', f='f')),
                         "/path/to/apps/a2/c2/f")
        self.assertEqual(
            filter_url('http://domain.com/a1/'), "/a1/default/index")
        self.assertEqual(filter_url(
            'http://domain.com/path/to/apps/a1/'), "/a1/default/index")
        self.assertEqual(filter_url(
            'http://domain.com/path/to/a1/'), "/a1/default/path ['to', 'a1']") 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:33,代码来源:test_router.py

示例6: test_StaticURL

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_StaticURL(self):
        # test response.static_version coupled with response.static_version_urls
        self.assertEqual(URL('a', 'c', 'f'), '/a/c/f')
        self.assertEqual(URL('a', 'static', 'design.css'), '/a/static/design.css')
        response = Storage()
        response.static_version = '1.2.3'
        from gluon.globals import current
        current.response = response
        self.assertEqual(URL('a', 'static', 'design.css'), '/a/static/design.css')
        response.static_version_urls = True
        self.assertEqual(URL('a', 'static', 'design.css'), '/a/static/_1.2.3/design.css') 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:13,代码来源:test_html.py

示例7: test_URL_encode

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_URL_encode(self):
        rtn = URL('a', 'c', 'f', args=['x', 'y', 'z'], vars={'maï': (1, 3), 'lié': 2}, url_encode=False)
        self.assertEqual(rtn, '/a/c/f/x/y/z?li\xc3\xa9=2&ma\xc3\xaf=1&ma\xc3\xaf=3') 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:5,代码来源:test_html.py

示例8: requires_https

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def requires_https(self):
        """
        If request comes in over HTTP, redirects it to HTTPS
        and secures the session.
        """
        cmd_opts = global_settings.cmd_options
        #checking if this is called within the scheduler or within the shell
        #in addition to checking if it's not a cronjob
        if ((cmd_opts and (cmd_opts.shell or cmd_opts.scheduler))
                or global_settings.cronjob or self.is_https):
            current.session.secure()
        else:
            current.session.forget()
            redirect(URL(scheme='https', args=self.args, vars=self.vars)) 
开发者ID:StuffShare,项目名称:StuffShare,代码行数:16,代码来源:globals.py

示例9: toolbar

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [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

示例10: test_router_functions2

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_router_functions2(self):
        '''
        Test more functions=[something]
        '''
        router_functions = dict(
            BASE=dict(
                default_application='init',
                applications='INIT',
            ),
            init=dict(
                #default_controller = 'default',
                controllers=['default', 'ctr'],
                #default_function = 'index',
                functions=['index', 'user', 'register', 'basicRegister',
                           'download', 'call', 'data', 'error']
            ),
        )

        load(rdict=router_functions)

        # outbound
        self.assertEqual(str(
            URL(a='init', c='default', f='index', args=['arg1'])), "/arg1")
        self.assertEqual(str(URL(
            a='init', c='default', f='user', args=['arg1'])), "/user/arg1")
        self.assertEqual(str(URL(
            a='init', c='default', f='user', args=['index'])), "/user/index")
        self.assertEqual(str(URL(a='init', c='default', f='index',
                         args=['index'])), "/index/index")
        self.assertEqual(str(
            URL(a='init', c='default', f='index', args=['init'])), "/init")
        self.assertEqual(str(URL(
            a='init', c='default', f='index', args=['ctr'])), "/index/ctr")
        self.assertEqual(str(URL(
            a='init', c='ctr', f='index', args=['arg'])), "/ctr/index/arg")
        self.assertEqual(str(URL(
            a='init', c='ctr', f='ctrf1', args=['arg'])), "/ctr/ctrf1/arg")
        self.assertEqual(str(URL(a='init', c='ctr', f='ctrf1',
                         args=['ctrf2'])), "/ctr/ctrf1/ctrf2")
        self.assertEqual(
            str(URL(a='init', c='default', f='register')), "/register")

        # inbound
        self.assertEqual(
            filter_url('http://d.com/arg'), "/init/default/index ['arg']")
        self.assertEqual(filter_url('http://d.com/user'), "/init/default/user")
        self.assertEqual(
            filter_url('http://d.com/user/arg'), "/init/default/user ['arg']")
        self.assertEqual(filter_url('http://d.com/ctr'), "/init/ctr/index")
        self.assertEqual(filter_url(
            'http://d.com/ctr/ctrf1/arg'), "/init/ctr/ctrf1 ['arg']") 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:53,代码来源:test_router.py

示例11: test_router_hyphen

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_router_hyphen(self):
        '''
        Test hyphen conversion
        '''
        router_hyphen = dict(
            BASE=dict(
                applications=['init', 'app1', 'app2'],
            ),
            init=dict(
                controllers=['default'],
            ),
            app1=dict(
                controllers=['default'],
                map_hyphen=True,
            ),
            app2=dict(
                controllers=['default'],
                map_hyphen=False,
            ),
        )
        load(rdict=router_hyphen)
        self.assertEqual(filter_url(
            'http://domain.com/init/default/fcn_1', out=True), "/fcn_1")
        self.assertEqual(
            filter_url('http://domain.com/static/filename-with_underscore'),
            norm_root("%s/applications/init/static/filename-with_underscore" % root))
        self.assertEqual(
            filter_url('http://domain.com/init/static/filename-with_underscore', out=True),
            "/init/static/filename-with_underscore")

        self.assertEqual(filter_url('http://domain.com/app2/fcn_1'),
                         "/app2/default/fcn_1")
        self.assertEqual(
            filter_url('http://domain.com/app2/ctr/fcn_1',
                       domain=('app2', None), out=True),
            "/ctr/fcn_1")
        self.assertEqual(
            filter_url('http://domain.com/app2/static/filename-with_underscore', domain=('app2', None), out=True),
            "/app2/static/filename-with_underscore")
        self.assertEqual(
            filter_url(
                'http://domain.com/app2/static/filename-with_underscore'),
            norm_root("%s/applications/app2/static/filename-with_underscore" % root))

        from gluon.globals import current
        current.response.static_version = None

        self.assertEqual(str(URL(a='init', c='default', f='a_b')), "/a_b")
        self.assertEqual(str(URL(a='app1', c='default', f='a_b')), "/app1/a-b")
        self.assertEqual(str(URL(a='app2', c='default', f='a_b')), "/app2/a_b")
        self.assertEqual(
            str(URL(a='app1', c='static', f='a/b_c')), "/app1/static/a/b_c")
        self.assertEqual(
            str(URL(a='app1', c='static/a', f='b_c')), "/app1/static/a/b_c")
        self.assertEqual(
            str(URL(a='app2', c='static', f='a/b_c')), "/app2/static/a/b_c")
        self.assertEqual(
            str(URL(a='app2', c='static/a', f='b_c')), "/app2/static/a/b_c") 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:60,代码来源:test_router.py

示例12: test_router_args

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_router_args(self):
        '''
        Test URL args parsing/generation
        '''
        load(rdict=dict())
        self.assertEqual(filter_url('http://domain.com/init/default/f/arg1'),
                         "/init/default/f ['arg1']")
        self.assertEqual(filter_url('http://domain.com/init/default/f/arg1/'),
                         "/init/default/f ['arg1']")
        self.assertEqual(filter_url('http://domain.com/init/default/f/arg1//'),
                         "/init/default/f ['arg1', '']")
        self.assertEqual(filter_url('http://domain.com/init/default/f//arg1'),
                         "/init/default/f ['', 'arg1']")
        self.assertEqual(
            filter_url('http://domain.com/init/default/f/arg1/arg2'),
            "/init/default/f ['arg1', 'arg2']")
        self.assertEqual(
            filter_url('http://domain.com/init/default/f/arg1//arg2'),
            "/init/default/f ['arg1', '', 'arg2']")
        self.assertEqual(
            filter_url('http://domain.com/init/default/f/arg1//arg3/'),
            "/init/default/f ['arg1', '', 'arg3']")
        self.assertEqual(
            filter_url('http://domain.com/init/default/f/arg1//arg3//'),
            "/init/default/f ['arg1', '', 'arg3', '']")

        self.assertEqual(
            filter_url('http://domain.com/init/default/f', out=True), "/f")
        self.assertEqual(map_url_out(None, None, 'init', 'default',
                         'f', None, None, None, None, None), "/f")
        self.assertEqual(map_url_out(None, None, 'init', 'default',
                         'f', [], None, None, None, None), "/f")
        self.assertEqual(map_url_out(None, None, 'init', 'default',
                         'f', ['arg1'], None, None, None, None), "/f")
        self.assertEqual(map_url_out(None, None, 'init', 'default',
                         'f', ['arg1', ''], None, None, None, None), "/f")
        self.assertEqual(
            str(URL(a='init', c='default', f='f', args=None)), "/f")
        self.assertEqual(
            str(URL(a='init', c='default', f='f', args=['arg1'])), "/f/arg1")
        self.assertEqual(str(URL(
            a='init', c='default', f='f', args=['arg1', ''])), "/f/arg1//")
        self.assertEqual(str(URL(a='init', c='default', f='f',
                         args=['arg1', '', 'arg3'])), "/f/arg1//arg3")
        self.assertEqual(str(
            URL(a='init', c='default', f='f', args=['ar g'])), "/f/ar%20g")
        self.assertEqual(str(
            URL(a='init', c='default', f='f', args=['årg'])), "/f/%C3%A5rg")
        self.assertEqual(URL(a='init', c='default', f='fünc'), "/fünc")
        self.assertEqual(
            to_bytes(URL(a='init', c='default', f='fünc')), b"/f\xc3\xbcnc") 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:53,代码来源:test_router.py

示例13: test_router_absolute

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_router_absolute(self):
        '''
        Test absolute URL
        '''
        load(rdict=dict())
        r = Storage()
        r.env = Storage()
        r.env.http_host = 'domain.com'
        r.env.wsgi_url_scheme = 'httpx'  # distinguish incoming scheme
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f')), "/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),
                         "httpx://domain.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host='host.com')),
                         "httpx://host.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme=True)),
                         "httpx://domain.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme=False)),
                         "/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme='https')),
                         "https://domain.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme='wss')),
                         "wss://domain.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=True, host=True)),
            "httpx://domain.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme='https', host=True)),
            "https://domain.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=False, host=True)),
            "httpx://domain.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=True, host='host.com')),
            "httpx://host.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=False, host='host.com')),
            "httpx://host.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', port=1234)),
                         "httpx://domain.com:1234/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=True, port=1234)),
            "httpx://domain.com:1234/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', host='host.com', port=1234)),
            "httpx://host.com:1234/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme='wss',
                host='host.com', port=1234)),
            "wss://host.com:1234/a/c/f") 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:51,代码来源:test_router.py

示例14: test_routes_anchor

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_routes_anchor(self):
        '''
        Test URL with anchor
        '''
        self.assertEqual(
            str(URL(a='a', c='c', f='f', anchor='anchor')), "/a/c/f#anchor")
        load(data='')
        self.assertEqual(
            str(URL(a='a', c='c', f='f', anchor='anchor')), "/a/c/f#anchor")
        args = ['a1', 'a2']
        self.assertEqual(
            str(URL(a='a', c='c', f='f', args=args, anchor='anchor')),
            "/a/c/f/a1/a2#anchor")
        vars = dict(v1=1, v2=2)
        self.assertEqual(
            str(URL(a='a', c='c', f='f', vars=vars, anchor='anchor')),
            "/a/c/f?v1=1&v2=2#anchor")
        self.assertEqual(
            str(URL(
                a='a', c='c', f='f', args=args, vars=vars, anchor='anchor')),
            "/a/c/f/a1/a2?v1=1&v2=2#anchor")

        data = r'''routes_out = [
            ('/init/default/index', '/'),
        ]'''
        load(data=data)
        self.assertEqual(str(URL(a='init', c='default', f='index')),
                         "/")
        self.assertEqual(
            str(URL(a='init', c='default', f='index', anchor='anchor')),
            "/init/default/index#anchor")

        data = r'''routes_out = [
            (r'/init/default/index(?P<anchor>(#.*)?)', r'/\g<anchor>'),
        ]'''
        load(data=data)
        self.assertEqual(str(URL(a='init', c='default', f='index')),
                         "/")
        self.assertEqual(
            str(URL(a='init', c='default', f='index', anchor='anchor')),
            "/#anchor")

        data = r'''routes_out = [
            (r'/init/default/index(?P<qa>([?#].*)?)', r'/\g<qa>'),
        ]'''
        load(data=data)
        self.assertEqual(str(URL(a='init', c='default', f='index')),
                         "/")
        self.assertEqual(
            str(URL(a='init', c='default', f='index', anchor='anchor')),
            "/#anchor")
        query = dict(var='abc')
        self.assertEqual(
            str(URL(a='init', c='default', f='index', vars=query)),
            "/?var=abc")
        self.assertEqual(
            str(URL(a='init', c='default', f='index',
                vars=query, anchor='anchor')),
            "/?var=abc#anchor") 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:61,代码来源:test_routes.py

示例15: test_routes_absolute

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import URL [as 别名]
def test_routes_absolute(self):
        '''
        Test absolute URL
        '''
        load(data='')
        r = Storage()
        r.env = Storage()
        r.env.http_host = 'domain.com'
        r.env.wsgi_url_scheme = 'httpx'  # distinguish incoming scheme
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f')), "/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),
                         "httpx://domain.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host='host.com')),
                         "httpx://host.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme=True)),
                         "httpx://domain.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme=False)),
                         "/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme='https')),
                         "https://domain.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme='wss')),
                         "wss://domain.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=True, host=True)),
            "httpx://domain.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme='https', host=True)),
            "https://domain.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=False, host=True)),
            "httpx://domain.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=True, host='host.com')),
            "httpx://host.com/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=False, host='host.com')),
            "httpx://host.com/a/c/f")
        self.assertEqual(str(URL(r=r, a='a', c='c', f='f', port=1234)),
                         "httpx://domain.com:1234/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme=True, port=1234)),
            "httpx://domain.com:1234/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', host='host.com', port=1234)),
            "httpx://host.com:1234/a/c/f")
        self.assertEqual(
            str(URL(r=r, a='a', c='c', f='f', scheme='wss',
                host='host.com', port=1234)),
            "wss://host.com:1234/a/c/f") 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:51,代码来源:test_routes.py


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