summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:42:51 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:42:51 +0000
commit5ce2e6c2c827cf877f73bf0e42e6afb7e6a71ccf (patch)
tree8c8c2fb8329e2db7dbfcf2c47026a11ff079e5c5 /django/core
parentea9cd5421382c047e2cc140bd6736b54ba660793 (diff)
queryset-refactor: Merged to [6220]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6337 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core')
-rw-r--r--django/core/handlers/base.py2
-rw-r--r--django/core/management/commands/adminindex.py3
-rw-r--r--django/core/management/commands/testserver.py6
-rw-r--r--django/core/management/validation.py4
4 files changed, 11 insertions, 4 deletions
diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py
index 768fc14b00..21737f682f 100644
--- a/django/core/handlers/base.py
+++ b/django/core/handlers/base.py
@@ -142,7 +142,7 @@ def fix_location_header(request, response):
Code constructing response objects is free to insert relative paths and
this function converts them to absolute paths.
"""
- if 'Location' in response.headers and http.get_host(request):
+ if 'location' in response.headers and http.get_host(request):
response['Location'] = request.build_absolute_uri(response['Location'])
return response
diff --git a/django/core/management/commands/adminindex.py b/django/core/management/commands/adminindex.py
index e3dd493fd3..4f389136ca 100644
--- a/django/core/management/commands/adminindex.py
+++ b/django/core/management/commands/adminindex.py
@@ -1,4 +1,5 @@
from django.core.management.base import AppCommand
+from django.utils.encoding import force_unicode
from django.utils.text import capfirst
MODULE_TEMPLATE = ''' {%% if perms.%(app)s.%(addperm)s or perms.%(app)s.%(changeperm)s %%}
@@ -24,7 +25,7 @@ class Command(AppCommand):
output.append(MODULE_TEMPLATE % {
'app': app_label,
'mod': model._meta.module_name,
- 'name': capfirst(model._meta.verbose_name_plural),
+ 'name': force_unicode(capfirst(model._meta.verbose_name_plural)),
'addperm': model._meta.get_add_permission(),
'changeperm': model._meta.get_change_permission(),
})
diff --git a/django/core/management/commands/testserver.py b/django/core/management/commands/testserver.py
index 50a10a12bc..9b169d3d9b 100644
--- a/django/core/management/commands/testserver.py
+++ b/django/core/management/commands/testserver.py
@@ -7,6 +7,9 @@ class Command(BaseCommand):
make_option('--verbosity', action='store', dest='verbosity', default='1',
type='choice', choices=['0', '1', '2'],
help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'),
+ make_option('--addrport', action='store', dest='addrport',
+ type='string', default='',
+ help='port number or ipaddr:port to run the server on'),
)
help = 'Runs a development server with data from the given fixture(s).'
args = '[fixture ...]'
@@ -19,6 +22,7 @@ class Command(BaseCommand):
from django.test.utils import create_test_db
verbosity = int(options.get('verbosity', 1))
+ addrport = options.get('addrport')
# Create a test database.
db_name = create_test_db(verbosity=verbosity)
@@ -30,4 +34,4 @@ class Command(BaseCommand):
# a strange error -- it causes this handle() method to be called
# multiple times.
shutdown_message = '\nServer stopped.\nNote that the test database, %r, has not been deleted. You can explore it on your own.' % db_name
- call_command('runserver', shutdown_message=shutdown_message, use_reloader=False)
+ call_command('runserver', addrport=addrport, shutdown_message=shutdown_message, use_reloader=False)
diff --git a/django/core/management/validation.py b/django/core/management/validation.py
index aa4ef47c2f..6528a34f29 100644
--- a/django/core/management/validation.py
+++ b/django/core/management/validation.py
@@ -1,5 +1,6 @@
import sys
from django.core.management.color import color_style
+from django.utils.itercompat import is_iterable
class ModelErrorCollection:
def __init__(self, outfile=sys.stdout):
@@ -51,7 +52,8 @@ def get_validation_errors(outfile, app=None):
if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple):
e.add(opts, '"%s": prepopulate_from should be a list or tuple.' % f.name)
if f.choices:
- if not hasattr(f.choices, '__iter__'):
+ if isinstance(f.choices, basestring) or \
+ not is_iterable(f.choices):
e.add(opts, '"%s": "choices" should be iterable (e.g., a tuple or list).' % f.name)
else:
for c in f.choices: