From e8020e2c5cd6dca816991845bd439e4524594f83 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 18 Sep 2011 12:22:15 +0200 Subject: [PATCH] Added comment to the importer wiping. --- flask/ext/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flask/ext/__init__.py b/flask/ext/__init__.py index 742e35dd..078e7dbd 100644 --- a/flask/ext/__init__.py +++ b/flask/ext/__init__.py @@ -31,6 +31,11 @@ class _ExtensionImporter(object): self.prefix = __name__ + '.' self.prefix_cutoff = __name__.count('.') + 1 + # since people might reload the flask.ext module (by accident or + # intentionally) we have to make sure to not add more than one + # import hook. We can't check class types here either since a new + # class will be created on reload. As a result of that we check + # the name of the class and remove stale instances. def _name(x): cls = type(x) return cls.__module__ + '.' + cls.__name__