summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
Diffstat (limited to 'django/core')
-rw-r--r--django/core/handlers/base.py3
-rw-r--r--django/core/management/commands/loaddata.py20
-rw-r--r--django/core/management/commands/sqlall.py2
-rw-r--r--django/core/serializers/json.py1
-rw-r--r--django/core/serializers/pyyaml.py1
5 files changed, 16 insertions, 11 deletions
diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py
index 7f68946f3d..a81bec322f 100644
--- a/django/core/handlers/base.py
+++ b/django/core/handlers/base.py
@@ -109,7 +109,8 @@ class BaseHandler(object):
except exceptions.PermissionDenied:
return http.HttpResponseForbidden('<h1>Permission denied</h1>')
except SystemExit:
- pass # See http://code.djangoproject.com/ticket/1023
+ # Allow sys.exit() to actually exit. See tickets #1023 and #4701
+ raise
except: # Handle everything else, including SuspiciousOperation, etc.
# Get the exception info now, in case another exception is thrown later.
exc_info = sys.exc_info()
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index e95be6b8d7..dde9e6eb80 100644
--- a/django/core/management/commands/loaddata.py
+++ b/django/core/management/commands/loaddata.py
@@ -30,7 +30,8 @@ class Command(BaseCommand):
show_traceback = options.get('traceback', False)
# Keep a count of the installed objects and fixtures
- count = [0, 0]
+ fixture_count = 0
+ object_count = 0
models = set()
humanize = lambda dirname: dirname and "'%s'" % dirname or 'absolute path'
@@ -65,7 +66,12 @@ class Command(BaseCommand):
else:
print "Skipping fixture '%s': %s is not a known serialization format" % (fixture_name, format)
- for fixture_dir in app_fixtures + list(settings.FIXTURE_DIRS) + ['']:
+ if os.path.isabs(fixture_name):
+ fixture_dirs = [fixture_name]
+ else:
+ fixture_dirs = app_fixtures + list(settings.FIXTURE_DIRS) + ['']
+
+ for fixture_dir in fixture_dirs:
if verbosity > 1:
print "Checking %s for fixtures..." % humanize(fixture_dir)
@@ -86,14 +92,14 @@ class Command(BaseCommand):
transaction.leave_transaction_management()
return
else:
- count[1] += 1
+ fixture_count += 1
if verbosity > 0:
print "Installing %s fixture '%s' from %s." % \
(format, fixture_name, humanize(fixture_dir))
try:
objects = serializers.deserialize(format, fixture)
for obj in objects:
- count[0] += 1
+ object_count += 1
models.add(obj.object.__class__)
obj.save()
label_found = True
@@ -113,7 +119,7 @@ class Command(BaseCommand):
print "No %s fixture '%s' in %s." % \
(format, fixture_name, humanize(fixture_dir))
- if count[0] > 0:
+ if object_count > 0:
sequence_sql = connection.ops.sequence_reset_sql(self.style, models)
if sequence_sql:
if verbosity > 1:
@@ -124,9 +130,9 @@ class Command(BaseCommand):
transaction.commit()
transaction.leave_transaction_management()
- if count[0] == 0:
+ if object_count == 0:
if verbosity >= 2:
print "No fixtures found."
else:
if verbosity > 0:
- print "Installed %d object(s) from %d fixture(s)" % tuple(count)
+ print "Installed %d object(s) from %d fixture(s)" % (object_count, fixture_count)
diff --git a/django/core/management/commands/sqlall.py b/django/core/management/commands/sqlall.py
index d63dfb4b10..bf3c734bb6 100644
--- a/django/core/management/commands/sqlall.py
+++ b/django/core/management/commands/sqlall.py
@@ -1,7 +1,7 @@
from django.core.management.base import AppCommand
class Command(AppCommand):
- help = "Prints the CREATE TABLE, initial-data and CREATE INDEX SQL statements for the given model module name(s)."
+ help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s)."
output_transaction = True
diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py
index e17b821f52..20797c02f6 100644
--- a/django/core/serializers/json.py
+++ b/django/core/serializers/json.py
@@ -4,7 +4,6 @@ Serialize data to/from JSON
import datetime
from django.utils import simplejson
-from django.utils.simplejson import decoder
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
try:
diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py
index 4c32a9686f..58cf59bed9 100644
--- a/django/core/serializers/pyyaml.py
+++ b/django/core/serializers/pyyaml.py
@@ -4,7 +4,6 @@ YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
-import datetime
from django.db import models
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer