Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Kill some more dead code.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16795 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8e1226b4a00a0d26752b26d0ebf21ff8c5a247ad 1 parent 345c4c4
@alex alex authored
View
8 django/core/handlers/base.py
@@ -152,7 +152,7 @@ def get_response(self, request):
try:
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
finally:
- receivers = signals.got_request_exception.send(sender=self.__class__, request=request)
+ signals.got_request_exception.send(sender=self.__class__, request=request)
except exceptions.PermissionDenied:
logger.warning(
'Forbidden (Permission denied): %s' % request.path,
@@ -168,14 +168,14 @@ def get_response(self, request):
response = self.handle_uncaught_exception(request,
resolver, sys.exc_info())
finally:
- receivers = signals.got_request_exception.send(
+ signals.got_request_exception.send(
sender=self.__class__, request=request)
except SystemExit:
# 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.
- receivers = signals.got_request_exception.send(sender=self.__class__, request=request)
+ signals.got_request_exception.send(sender=self.__class__, request=request)
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
finally:
# Reset URLconf for this thread on the way out for complete
@@ -188,7 +188,7 @@ def get_response(self, request):
response = middleware_method(request, response)
response = self.apply_response_fixes(request, response)
except: # Any exception should be gathered and handled
- receivers = signals.got_request_exception.send(sender=self.__class__, request=request)
+ signals.got_request_exception.send(sender=self.__class__, request=request)
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
return response
View
2  django/core/management/__init__.py
@@ -420,7 +420,7 @@ def setup_environ(settings_mod, original_settings_path=None):
# Import the project module. We add the parent directory to PYTHONPATH to
# avoid some of the path errors new users can have.
sys.path.append(os.path.join(project_directory, os.pardir))
- project_module = import_module(project_name)
+ import_module(project_name)
sys.path.pop()
return project_directory
View
5 django/core/management/commands/dumpdata.py
@@ -1,7 +1,7 @@
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError
from django.core import serializers
-from django.db import connections, router, DEFAULT_DB_ALIAS
+from django.db import router, DEFAULT_DB_ALIAS
from django.utils.datastructures import SortedDict
from optparse import make_option
@@ -28,12 +28,11 @@ class Command(BaseCommand):
args = '[appname appname.ModelName ...]'
def handle(self, *app_labels, **options):
- from django.db.models import get_app, get_apps, get_models, get_model
+ from django.db.models import get_app, get_apps, get_model
format = options.get('format','json')
indent = options.get('indent',None)
using = options.get('database', DEFAULT_DB_ALIAS)
- connection = connections[using]
excludes = options.get('exclude',[])
show_traceback = options.get('traceback', False)
use_natural_keys = options.get('use_natural_keys', False)
View
14 django/core/management/commands/shell.py
@@ -44,7 +44,7 @@ def handle_noargs(self, **options):
# XXX: (Temporary) workaround for ticket #1796: force early loading of all
# models from installed apps.
from django.db.models.loading import get_models
- loaded_models = get_models()
+ get_models()
use_plain = options.get('plain', False)
@@ -72,12 +72,12 @@ def handle_noargs(self, **options):
# We want to honor both $PYTHONSTARTUP and .pythonrc.py, so follow system
# conventions and get $PYTHONSTARTUP first then import user.
- if not use_plain:
- pythonrc = os.environ.get("PYTHONSTARTUP")
- if pythonrc and os.path.isfile(pythonrc):
- try:
- execfile(pythonrc)
- except NameError:
+ if not use_plain:
+ pythonrc = os.environ.get("PYTHONSTARTUP")
+ if pythonrc and os.path.isfile(pythonrc):
+ try:
+ execfile(pythonrc)
+ except NameError:
pass
# This will import .pythonrc.py as a side-effect
import user
View
1  django/core/management/sql.py
@@ -127,7 +127,6 @@ def sql_custom(app, style, connection):
output = []
app_models = get_models(app)
- app_dir = os.path.normpath(os.path.join(os.path.dirname(app.__file__), 'sql'))
for model in app_models:
output.extend(custom_sql_for_model(model, style, connection))
View
14 django/core/validators.py
@@ -51,7 +51,7 @@ class URLValidator(RegexValidator):
r'(?::\d+)?' # optional port
r'(?:/?|[/?]\S+)$', re.IGNORECASE)
- def __init__(self, verify_exists=False,
+ def __init__(self, verify_exists=False,
validator_user_agent=URL_VALIDATOR_USER_AGENT):
super(URLValidator, self).__init__()
self.verify_exists = verify_exists
@@ -99,7 +99,7 @@ def __call__(self, value):
req.get_method = lambda: 'HEAD'
#Create an opener that does not support local file access
opener = urllib2.OpenerDirector()
-
+
#Don't follow redirects, but don't treat them as errors either
error_nop = lambda *args, **kwargs: True
http_error_processor = urllib2.HTTPErrorProcessor()
@@ -114,10 +114,11 @@ def __call__(self, value):
http_error_processor]
try:
import ssl
- handlers.append(urllib2.HTTPSHandler())
- except:
- #Python isn't compiled with SSL support
+ except ImportError:
+ # Python isn't compiled with SSL support
pass
+ else:
+ handlers.append(urllib2.HTTPSHandler())
map(opener.add_handler, handlers)
opener.http_error_301 = lambda: True
if platform.python_version_tuple() >= (2, 6):
@@ -133,7 +134,7 @@ def __call__(self, value):
def validate_integer(value):
try:
int(value)
- except (ValueError, TypeError), e:
+ except (ValueError, TypeError):
raise ValidationError('')
class EmailValidator(RegexValidator):
@@ -145,7 +146,6 @@ def __call__(self, value):
# Trivial case failed. Try for possible IDN domain-part
if value and u'@' in value:
parts = value.split(u'@')
- domain_part = parts[-1]
try:
parts[-1] = parts[-1].encode('idna')
except UnicodeError:
View
3  django/template/defaultfilters.py
@@ -607,7 +607,8 @@ def convert_old_style_list(list_):
if second_item == []:
return [first_item], True
try:
- it = iter(second_item) # see if second item is iterable
+ # see if second item is iterable
+ iter(second_item)
except TypeError:
return list_, False
old_style_list = True
View
3  django/template/defaulttags.py
@@ -51,7 +51,7 @@ def token_kwargs(bits, parser, support_legacy=False):
kwargs = {}
while bits:
- if kwarg_format:
+ if kwarg_format:
match = kwarg_re.match(bits[0])
if not match or not match.group(1):
return kwargs
@@ -276,7 +276,6 @@ def render(self, context):
compare_to = None
if compare_to != self._last_seen:
- firstloop = (self._last_seen == None)
self._last_seen = compare_to
content = self.nodelist_true.render(context)
return content
Please sign in to comment.
Something went wrong with that request. Please try again.