~ubuntu-branches/ubuntu/quantal/python-django/quantal

« back to all changes in this revision

Viewing changes to django/conf/urls/defaults.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2009-07-29 11:26:28 UTC
  • mfrom: (1.1.8 upstream) (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090729112628-pg09ino8sz0sj21t
Tags: 1.1-1
* New upstream release.
* Merge from experimental:
  - Ship FastCGI initscript and /etc/default file in python-django's examples
    directory (Closes: #538863)
  - Drop "05_10539-sphinx06-compatibility.diff"; it has been applied
    upstream.
  - Bump Standards-Version to 3.8.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
handler404 = 'django.views.defaults.page_not_found'
7
7
handler500 = 'django.views.defaults.server_error'
8
8
 
9
 
include = lambda urlconf_module: [urlconf_module]
 
9
def include(arg, namespace=None, app_name=None):
 
10
    if isinstance(arg, tuple):
 
11
        # callable returning a namespace hint
 
12
        if namespace:
 
13
            raise ImproperlyConfigured('Cannot override the namespace for a dynamic module that provides a namespace')
 
14
        urlconf_module, app_name, namespace = arg
 
15
    else:
 
16
        # No namespace hint - use manually provided namespace
 
17
        urlconf_module = arg
 
18
    return (urlconf_module, app_name, namespace)
10
19
 
11
20
def patterns(prefix, *args):
12
21
    pattern_list = []
19
28
    return pattern_list
20
29
 
21
30
def url(regex, view, kwargs=None, name=None, prefix=''):
22
 
    if type(view) == list:
 
31
    if isinstance(view, (list,tuple)):
23
32
        # For include(...) processing.
24
 
        return RegexURLResolver(regex, view[0], kwargs)
 
33
        urlconf_module, app_name, namespace = view
 
34
        return RegexURLResolver(regex, urlconf_module, kwargs, app_name=app_name, namespace=namespace)
25
35
    else:
26
36
        if isinstance(view, basestring):
27
37
            if not view: