File: included_namespace_urls.py

package info (click to toggle)
python-django 1.8.18-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 41,628 kB
  • sloc: python: 189,488; xml: 695; makefile: 194; sh: 169; sql: 11
file content (29 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import warnings

from django.conf.urls import include, patterns, url
from django.utils.deprecation import RemovedInDjango110Warning

from .namespace_urls import URLObject
from .views import view_class_instance

testobj3 = URLObject('testapp', 'test-ns3')

# test deprecated patterns() function. convert to list of urls() in Django 1.10
with warnings.catch_warnings():
    warnings.filterwarnings('ignore', category=RemovedInDjango110Warning)

    urlpatterns = patterns('urlpatterns_reverse.views',
        url(r'^normal/$', 'empty_view', name='inc-normal-view'),
        url(r'^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', 'empty_view', name='inc-normal-view'),

        url(r'^\+\\\$\*/$', 'empty_view', name='inc-special-view'),

        url(r'^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$', 'empty_view', name='inc-mixed-args'),
        url(r'^no_kwargs/([0-9]+)/([0-9]+)/$', 'empty_view', name='inc-no-kwargs'),

        url(r'^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', view_class_instance, name='inc-view-class'),

        (r'^test3/', include(testobj3.urls)),
        (r'^ns-included3/', include('urlpatterns_reverse.included_urls', namespace='inc-ns3')),
        (r'^ns-included4/', include('urlpatterns_reverse.namespace_urls', namespace='inc-ns4')),
    )