summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/daemonize.py4
-rw-r--r--django/utils/decorators.py2
-rw-r--r--django/utils/dictconfig.py28
-rw-r--r--django/utils/encoding.py2
4 files changed, 18 insertions, 18 deletions
diff --git a/django/utils/daemonize.py b/django/utils/daemonize.py
index 68e5392d89..a9d5128b33 100644
--- a/django/utils/daemonize.py
+++ b/django/utils/daemonize.py
@@ -9,7 +9,7 @@ if os.name == 'posix':
try:
if os.fork() > 0:
sys.exit(0) # kill off parent
- except OSError, e:
+ except OSError as e:
sys.stderr.write("fork #1 failed: (%d) %s\n" % (e.errno, e.strerror))
sys.exit(1)
os.setsid()
@@ -20,7 +20,7 @@ if os.name == 'posix':
try:
if os.fork() > 0:
os._exit(0)
- except OSError, e:
+ except OSError as e:
sys.stderr.write("fork #2 failed: (%d) %s\n" % (e.errno, e.strerror))
os._exit(1)
diff --git a/django/utils/decorators.py b/django/utils/decorators.py
index 22f33a76a4..e653a736af 100644
--- a/django/utils/decorators.py
+++ b/django/utils/decorators.py
@@ -89,7 +89,7 @@ def make_middleware_decorator(middleware_class):
return result
try:
response = view_func(request, *args, **kwargs)
- except Exception, e:
+ except Exception as e:
if hasattr(middleware, 'process_exception'):
result = middleware.process_exception(request, e)
if result is not None:
diff --git a/django/utils/dictconfig.py b/django/utils/dictconfig.py
index 42fbd9393a..ae797afcc5 100644
--- a/django/utils/dictconfig.py
+++ b/django/utils/dictconfig.py
@@ -297,21 +297,21 @@ class DictConfigurator(BaseConfigurator):
level = handler_config.get('level', None)
if level:
handler.setLevel(_checkLevel(level))
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to configure handler '
'%r: %s' % (name, e))
loggers = config.get('loggers', EMPTY_DICT)
for name in loggers:
try:
self.configure_logger(name, loggers[name], True)
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to configure logger '
'%r: %s' % (name, e))
root = config.get('root', None)
if root:
try:
self.configure_root(root, True)
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to configure root '
'logger: %s' % e)
else:
@@ -326,7 +326,7 @@ class DictConfigurator(BaseConfigurator):
try:
formatters[name] = self.configure_formatter(
formatters[name])
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to configure '
'formatter %r: %s' % (name, e))
# Next, do filters - they don't refer to anything else, either
@@ -334,7 +334,7 @@ class DictConfigurator(BaseConfigurator):
for name in filters:
try:
filters[name] = self.configure_filter(filters[name])
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to configure '
'filter %r: %s' % (name, e))
@@ -347,7 +347,7 @@ class DictConfigurator(BaseConfigurator):
handler = self.configure_handler(handlers[name])
handler.name = name
handlers[name] = handler
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to configure handler '
'%r: %s' % (name, e))
# Next, do loggers - they refer to handlers and filters
@@ -386,7 +386,7 @@ class DictConfigurator(BaseConfigurator):
existing.remove(name)
try:
self.configure_logger(name, loggers[name])
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to configure logger '
'%r: %s' % (name, e))
@@ -409,7 +409,7 @@ class DictConfigurator(BaseConfigurator):
if root:
try:
self.configure_root(root)
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to configure root '
'logger: %s' % e)
finally:
@@ -421,7 +421,7 @@ class DictConfigurator(BaseConfigurator):
factory = config['()'] # for use in exception handler
try:
result = self.configure_custom(config)
- except TypeError, te:
+ except TypeError as te:
if "'format'" not in str(te):
raise
#Name of parameter changed from fmt to format.
@@ -451,7 +451,7 @@ class DictConfigurator(BaseConfigurator):
for f in filters:
try:
filterer.addFilter(self.config['filters'][f])
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to add filter %r: %s' % (f, e))
def configure_handler(self, config):
@@ -460,7 +460,7 @@ class DictConfigurator(BaseConfigurator):
if formatter:
try:
formatter = self.config['formatters'][formatter]
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to set formatter '
'%r: %s' % (formatter, e))
level = config.pop('level', None)
@@ -477,7 +477,7 @@ class DictConfigurator(BaseConfigurator):
'target' in config:
try:
config['target'] = self.config['handlers'][config['target']]
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to set target handler '
'%r: %s' % (config['target'], e))
elif issubclass(klass, logging.handlers.SMTPHandler) and\
@@ -490,7 +490,7 @@ class DictConfigurator(BaseConfigurator):
kwargs = dict([(k, config[k]) for k in config if valid_ident(k)])
try:
result = factory(**kwargs)
- except TypeError, te:
+ except TypeError as te:
if "'stream'" not in str(te):
raise
#The argument name changed from strm to stream
@@ -512,7 +512,7 @@ class DictConfigurator(BaseConfigurator):
for h in handlers:
try:
logger.addHandler(self.config['handlers'][h])
- except StandardError, e:
+ except StandardError as e:
raise ValueError('Unable to add handler %r: %s' % (h, e))
def common_logger_config(self, logger, config, incremental=False):
diff --git a/django/utils/encoding.py b/django/utils/encoding.py
index 36e0da2915..d9b59448a9 100644
--- a/django/utils/encoding.py
+++ b/django/utils/encoding.py
@@ -88,7 +88,7 @@ def force_unicode(s, encoding='utf-8', strings_only=False, errors='strict'):
# errors), so that if s is a SafeString, it ends up being a
# SafeUnicode at the end.
s = s.decode(encoding, errors)
- except UnicodeDecodeError, e:
+ except UnicodeDecodeError as e:
if not isinstance(s, Exception):
raise DjangoUnicodeDecodeError(s, *e.args)
else: