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
This commit is contained in:
Malcolm Tredinnick 2007-06-10 02:00:46 +00:00
parent 6fc10f50b0
commit 130c7eee80
4 changed files with 14 additions and 10 deletions

View File

@ -234,6 +234,7 @@ answer newbie questions, and generally made Django that much better:
wangchun <yaohua2000@gmail.com> wangchun <yaohua2000@gmail.com>
Dan Watson <http://theidioteque.net/> Dan Watson <http://theidioteque.net/>
Chris Wesseling <Chris.Wesseling@cwi.nl> Chris Wesseling <Chris.Wesseling@cwi.nl>
James Wheare <django@sparemint.com>
charly.wilhelm@gmail.com charly.wilhelm@gmail.com
Rachel Willmer <http://www.willmer.com/kb/> Rachel Willmer <http://www.willmer.com/kb/>
Gary Wilson <gary.wilson@gmail.com> Gary Wilson <gary.wilson@gmail.com>

View File

@ -1 +1,8 @@
VERSION = (0, 97, 'pre') 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

View File

@ -241,7 +241,8 @@ TRANSACTIONS_MANAGED = False
# The User-Agent string to use when checking for URL validity through the # The User-Agent string to use when checking for URL validity through the
# isExistingURL validator. # 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 # # MIDDLEWARE #

View File

@ -3,14 +3,17 @@
import django import django
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
import os, re, shutil, sys, textwrap
from optparse import OptionParser from optparse import OptionParser
from django.utils import termcolors from django.utils import termcolors
import os, re, shutil, sys, textwrap
# For Python 2.3 # For Python 2.3
if not hasattr(__builtins__, 'set'): if not hasattr(__builtins__, 'set'):
from sets import Set as 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 %%} MODULE_TEMPLATE = ''' {%% if perms.%(app)s.%(addperm)s or perms.%(app)s.%(changeperm)s %%}
<tr> <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> <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. # 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() 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): def get_sql_create(app):
"Returns a list of the CREATE TABLE SQL statements for the given app." "Returns a list of the CREATE TABLE SQL statements for the given app."
from django.db import get_creation_module, models from django.db import get_creation_module, models