diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-06-10 02:00:46 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-06-10 02:00:46 +0000 |
| commit | 130c7eee8058847083ad58f1f9abdcf51e879032 (patch) | |
| tree | aa1d3a0ea82d72f147c5667fdbc18393ba8e0fe6 | |
| parent | 6fc10f50b0c9b877fffcad4893056cb91fa66b4f (diff) | |
Fixed #4517 -- Made sure that URL_VALIDATOR_USER_AGENT includes the up-to-date
Django version number. Thanks, James Wheare.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5451 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/__init__.py | 7 | ||||
| -rw-r--r-- | django/conf/global_settings.py | 3 | ||||
| -rw-r--r-- | django/core/management.py | 13 |
4 files changed, 14 insertions, 10 deletions
@@ -234,6 +234,7 @@ answer newbie questions, and generally made Django that much better: wangchun <yaohua2000@gmail.com> Dan Watson <http://theidioteque.net/> Chris Wesseling <Chris.Wesseling@cwi.nl> + James Wheare <django@sparemint.com> charly.wilhelm@gmail.com Rachel Willmer <http://www.willmer.com/kb/> Gary Wilson <gary.wilson@gmail.com> diff --git a/django/__init__.py b/django/__init__.py index 7a24af2b4e..17d8c519cc 100644 --- a/django/__init__.py +++ b/django/__init__.py @@ -1 +1,8 @@ VERSION = (0, 97, 'pre') + +def get_version(): + "Returns the version as a human-format string." + v = '.'.join([str(i) for i in VERSION[:-1]]) + if VERSION[-1]: + v += '-' + VERSION[-1] + return v diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 2be6a4ef95..8bdeb64efc 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -241,7 +241,8 @@ TRANSACTIONS_MANAGED = False # The User-Agent string to use when checking for URL validity through the # isExistingURL validator. -URL_VALIDATOR_USER_AGENT = "Django/0.96pre (http://www.djangoproject.com)" +from django import get_version +URL_VALIDATOR_USER_AGENT = "Django/%s (http://www.djangoproject.com)" % get_version() ############## # MIDDLEWARE # diff --git a/django/core/management.py b/django/core/management.py index b763a5cb1c..213eb4602c 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -3,14 +3,17 @@ import django from django.core.exceptions import ImproperlyConfigured -import os, re, shutil, sys, textwrap from optparse import OptionParser from django.utils import termcolors +import os, re, shutil, sys, textwrap # For Python 2.3 if not hasattr(__builtins__, 'set'): from sets import Set as set +# For backwards compatibility: get_version() used to be in this module. +get_version = django.get_version + MODULE_TEMPLATE = ''' {%% if perms.%(app)s.%(addperm)s or perms.%(app)s.%(changeperm)s %%} <tr> <th>{%% if perms.%(app)s.%(changeperm)s %%}<a href="%(app)s/%(mod)s/">{%% endif %%}%(name)s{%% if perms.%(app)s.%(changeperm)s %%}</a>{%% endif %%}</th> @@ -93,14 +96,6 @@ def _get_sequence_list(): # field as the field to which it points. get_rel_data_type = lambda f: (f.get_internal_type() in ('AutoField', 'PositiveIntegerField', 'PositiveSmallIntegerField')) and 'IntegerField' or f.get_internal_type() -def get_version(): - "Returns the version as a human-format string." - from django import VERSION - v = '.'.join([str(i) for i in VERSION[:-1]]) - if VERSION[-1]: - v += '-' + VERSION[-1] - return v - def get_sql_create(app): "Returns a list of the CREATE TABLE SQL statements for the given app." from django.db import get_creation_module, models |
