Commit 3904b74a authored by Claude Paroz's avatar Claude Paroz
Browse files

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).
parent eefb00f3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ class Settings(BaseSettings):

        try:
            mod = importlib.import_module(self.SETTINGS_MODULE)
        except ImportError, e:
        except ImportError as e:
            raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))

        # Settings that should be converted into tuples if they're mistakenly entered
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
            mod = import_module(module)
            WebDriver = getattr(mod, attr)
            cls.selenium = WebDriver()
        except Exception, e:
        except Exception as e:
            raise SkipTest('Selenium webdriver "%s" not installed or not '
                           'operational: %s' % (cls.webdriver_class, str(e)))
        super(AdminSeleniumWebDriverTestCase, cls).setUpClass()
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ class NestedObjects(Collector):
                self.add_edge(None, obj)
        try:
            return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)
        except models.ProtectedError, e:
        except models.ProtectedError as e:
            self.protected.update(e.protected_objects)

    def related_objects(self, related, objs):
+2 −2
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ class ChangeList(object):
                use_distinct = (use_distinct or
                                lookup_needs_distinct(self.lookup_opts, key))
            return filter_specs, bool(filter_specs), lookup_params, use_distinct
        except FieldDoesNotExist, e:
        except FieldDoesNotExist as e:
            raise IncorrectLookupParameters(e)

    def get_query_string(self, new_params=None, remove=None):
@@ -316,7 +316,7 @@ class ChangeList(object):
            # Allow certain types of errors to be re-raised as-is so that the
            # caller can treat them in a special way.
            raise
        except Exception, e:
        except Exception as e:
            # Every other error is caught with a naked except, because we don't
            # have any other way of validating lookup parameters. They might be
            # invalid if the keyword arguments are incorrect, or if the values
+1 −1
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ def load_all_installed_template_libraries():
        for library_name in libraries:
            try:
                lib = template.get_library(library_name)
            except template.InvalidTemplateLibrary, e:
            except template.InvalidTemplateLibrary:
                pass

def get_return_data_type(func_name):
Loading