From 3904b74a3f2f92fefe1d39281ed683c52f2fef03 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 28 Apr 2012 18:09:37 +0200 Subject: Fixed #18013 -- Use the new 'as' syntax for exceptions. Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6). --- django/dispatch/dispatcher.py | 2 +- django/dispatch/saferef.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'django/dispatch') diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py index ed9da57f27..0903c3a8a9 100644 --- a/django/dispatch/dispatcher.py +++ b/django/dispatch/dispatcher.py @@ -205,7 +205,7 @@ class Signal(object): for receiver in self._live_receivers(_make_id(sender)): try: response = receiver(signal=self, sender=sender, **named) - except Exception, err: + except Exception as err: responses.append((receiver, err)) else: responses.append((receiver, response)) diff --git a/django/dispatch/saferef.py b/django/dispatch/saferef.py index 1c7d16474f..364c13e43b 100644 --- a/django/dispatch/saferef.py +++ b/django/dispatch/saferef.py @@ -119,10 +119,10 @@ class BoundMethodWeakref(object): try: if callable( function ): function( self ) - except Exception, e: + except Exception as e: try: traceback.print_exc() - except AttributeError, err: + except AttributeError as err: print '''Exception during saferef %s cleanup function %s: %s'''%( self, function, e ) -- cgit v1.3