~phanatic/django-configglue/more-supported-releases

« back to all changes in this revision

Viewing changes to django_configglue/schema.py

  • Committer: Ricardo Kirkner
  • Date: 2011-08-05 20:32:14 UTC
  • mfrom: (60.1.1 trunk)
  • Revision ID: ricardo.kirkner@canonical.com-20110805203214-ahzl38y6ikgict8q
better handling of the root_urlconf default for the most common case

Show diffs side-by-side

added added

removed removed

Lines of Context:
510
510
        ####################
511
511
 
512
512
        site_id = IntOption(default=1)
513
 
        root_urlconf = StringOption(default='{{ project_name }}.urls')
 
513
        # use a slightly different default than in the project settings
 
514
        # template as it includes the {{ project_name }} variable
 
515
        # not relying on that variable makes more sense in this case
 
516
        root_urlconf = StringOption(default='urls')
514
517
 
515
518
 
516
519
Django112Base = derivate_django_schema(
1107
1110
                inspect.getmembers(global_settings) if name.isupper()])
1108
1111
            project_options = dict([(name.lower(), value) for (name, value) in
1109
1112
                inspect.getmembers(project_settings) if name.isupper()])
 
1113
            # handle special case of ROOT_URLCONF which depends on the
 
1114
            # project name
 
1115
            root_urlconf = project_options['root_urlconf'].replace(
 
1116
                '{{ project_name }}.', '')
 
1117
            project_options['root_urlconf'] = root_urlconf
 
1118
 
1110
1119
            options.update(project_options)
1111
1120
 
1112
1121
        class DjangoSchema(Schema):