Here are the examples of the python api django.urls.RegexURLResolver taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
Example 1
def url(self, route, view, kwargs=None, name=None):
re_route, converters = self.translate(route)
re_route = '^' + re_route
if isinstance(view, (list, tuple)):
assert not converters, 'converters in include-patterns not supported'
urlconf_module, app_name, namespace = view
return RegexURLResolver(re_route, urlconf_module, kwargs, app_name=app_name, namespace=namespace)
else:
re_route += '$'
return CastingRegexURLPattern(converters, re_route, view, kwargs, name)
3
Example 2
Project: django Source File: __init__.py
def url(regex, view, kwargs=None, name=None):
if isinstance(view, (list, tuple)):
# For include(...) processing.
urlconf_module, app_name, namespace = view
return RegexURLResolver(regex, urlconf_module, kwargs, app_name=app_name, namespace=namespace)
elif callable(view):
return RegexURLPattern(regex, view, kwargs, name)
else:
raise TypeError('view must be a callable or a list/tuple in the case of include().')