Ticket #4517: version.diff

File version.diff, 2.9 KB (added by James Wheare <django@…>, 17 years ago)

Moves get_version to django/init.py

  • django/conf/global_settings.py

     
    241241
    242242# The User-Agent string to use when checking for URL validity through the
    243243# isExistingURL validator.
    244 URL_VALIDATOR_USER_AGENT = "Django/0.96pre (http://www.djangoproject.com)"
     244from django import get_version
     245URL_VALIDATOR_USER_AGENT = "Django/%s (http://www.djangoproject.com)" % get_version()
    245246
    246247##############
    247248# MIDDLEWARE #
  • django/__init__.py

     
    11VERSION = (0, 97, 'pre')
     2
     3def get_version():
     4    "Returns the version as a human-format string."
     5    v = '.'.join([str(i) for i in VERSION[:-1]])
     6    if VERSION[-1]:
     7        v += '-' + VERSION[-1]
     8    return v
  • django/core/management.py

     
    2020    {%% endif %%}'''
    2121
    2222APP_ARGS = '[appname ...]'
     23DJANGO_VERSION = django.get_version()
    2324
    2425# Use django.__path__[0] because we don't know which directory django into
    2526# which has been installed.
     
    9394# field as the field to which it points.
    9495get_rel_data_type = lambda f: (f.get_internal_type() in ('AutoField', 'PositiveIntegerField', 'PositiveSmallIntegerField')) and 'IntegerField' or f.get_internal_type()
    9596
    96 def get_version():
    97     "Returns the version as a human-format string."
    98     from django import VERSION
    99     v = '.'.join([str(i) for i in VERSION[:-1]])
    100     if VERSION[-1]:
    101         v += '-' + VERSION[-1]
    102     return v
    103 
    10497def get_sql_create(app):
    10598    "Returns a list of the CREATE TABLE SQL statements for the given app."
    10699    from django.db import get_creation_module, models
     
    11721165        from django.conf import settings
    11731166        print "Validating models..."
    11741167        validate()
    1175         print "\nDjango version %s, using settings %r" % (get_version(), settings.SETTINGS_MODULE)
     1168        print "\nDjango version %s, using settings %r" % (DJANGO_VERSION, settings.SETTINGS_MODULE)
    11761169        print "Development server is running at http://%s:%s/" % (addr, port)
    11771170        print "Quit the server with %s." % quit_command
    11781171        try:
     
    15251518        argv = sys.argv
    15261519
    15271520    # Parse the command-line arguments. optparse handles the dirty work.
    1528     parser = DjangoOptionParser(usage=get_usage(action_mapping), version=get_version())
     1521    parser = DjangoOptionParser(usage=get_usage(action_mapping), version=DJANGO_VERSION)
    15291522    parser.add_option('--settings',
    15301523        help='Python path to settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.')
    15311524    parser.add_option('--pythonpath',
Back to Top