diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/template/__init__.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/django/core/template/__init__.py b/django/core/template/__init__.py index 8144e651a1..c399c93c14 100644 --- a/django/core/template/__init__.py +++ b/django/core/template/__init__.py @@ -890,13 +890,11 @@ def get_library(module_name): mod = __import__(module_name, '', '', ['']) except ImportError, e: raise InvalidTemplateLibrary, "Could not load template library from %s, %s" % (module_name, e) - for k, v in mod.__dict__.items(): - if isinstance(v, Library): - lib = v - libraries[module_name] = lib - break - if not lib: - raise InvalidTemplateLibrary, "Template library %s does not have a Library member" % module_name + try: + lib = mod.register + libraries[module_name] = lib + except AttributeError: + raise InvalidTemplateLibrary, "Template library %s does not have a variable named 'register'" % module_name return lib def add_to_builtins(module_name): |
