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


Python urlresolvers.RegexURLPattern方法代码示例

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


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

示例1: test_01_nb_of_route

# 需要导入模块: from django.core import urlresolvers [as 别名]
# 或者: from django.core.urlresolvers import RegexURLPattern [as 别名]
def test_01_nb_of_route(self):
        urls = ApiUrls.get_urls()
        # check the nb of defined ressources should be the same as the
        # number of route + 1 done by tastypie
        self.assertEqual(len(urls), self.nb_route + 1)
        self.assertTrue(isinstance(urls.pop(0), RegexURLPattern))

        event_url = urls.pop(0)
        self.assertTrue(isinstance(event_url, RegexURLResolver))
        # XXX depend on the version of tastypie: only use one or both method:
        #     prepend_urls/override_urls
        self.assertIn(len(event_url.url_patterns),
                      [self.nb_route_for_event, self.nb_route_for_event + 2])

        for url in urls:
            self.assertTrue(isinstance(url, RegexURLResolver))
            self.assertEqual(len(url.url_patterns),
                             self.nb_default_route_by_ressource) 
开发者ID:Gandi,项目名称:baobab,代码行数:20,代码来源:test_route.py

示例2: get_all_view_names

# 需要导入模块: from django.core import urlresolvers [as 别名]
# 或者: from django.core.urlresolvers import RegexURLPattern [as 别名]
def get_all_view_names(self, urlpatterns, parent_regex=''):
        for pattern in urlpatterns:
            if isinstance(pattern, RegexURLResolver):
                regex = '' if pattern._regex == "^" else pattern._regex
                self.get_all_view_names(urlpatterns=pattern.url_patterns, parent_regex=parent_regex + regex)
            elif isinstance(pattern, RegexURLPattern) and self._is_drf_view(pattern) and not self._is_format_endpoint(pattern):
                api_endpoint = ApiEndpoint(pattern, parent_regex, self.drf_router)
                self.endpoints.append(api_endpoint) 
开发者ID:manosim,项目名称:django-rest-framework-docs,代码行数:10,代码来源:api_docs.py

示例3: test_urls

# 需要导入模块: from django.core import urlresolvers [as 别名]
# 或者: from django.core.urlresolvers import RegexURLPattern [as 别名]
def test_urls(self):
        self.assertTrue(isinstance(api.urls, list))
        for api_url in api.urls:
            self.assertTrue(isinstance(api_url, RegexURLPattern)) 
开发者ID:AirtestProject,项目名称:Poco,代码行数:6,代码来源:tests.py

示例4: find_url_callbacks

# 需要导入模块: from django.core import urlresolvers [as 别名]
# 或者: from django.core.urlresolvers import RegexURLPattern [as 别名]
def find_url_callbacks(urls_module):
    urlpatterns = urls_module.urlpatterns
    hid_list = [urls_module.__name__]
    for pattern in urlpatterns:
        if isinstance(pattern, RegexURLPattern):
            hid_list.append(pattern.callback.__module__)
        elif isinstance(pattern, RegexURLResolver):
            hid_list += find_url_callbacks(pattern.urlconf_module)
    return hid_list 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:11,代码来源:django-import-finder.py


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