1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #6587 -- Removed nasty __path__ hacking in templatetag loading. Thanks to Øyvind Satvik and Andrew Badr for their work on this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2010-01-26 01:38:50 +00:00
parent 9cd1d6ed87
commit 12d3799dd2
5 changed files with 73 additions and 28 deletions

View File

@@ -309,12 +309,17 @@ def missing_docutils_page(request):
def load_all_installed_template_libraries():
# Load/register all template tag libraries from installed apps.
for e in templatetags.__path__:
libraries = [os.path.splitext(p)[0] for p in os.listdir(e) if p.endswith('.py') and p[0].isalpha()]
for module_name in template.get_templatetags_modules():
mod = import_module(module_name)
libraries = [
os.path.splitext(p)[0]
for p in os.listdir(os.path.dirname(mod.__file__))
if p.endswith('.py') and p[0].isalpha()
]
for library_name in libraries:
try:
lib = template.get_library("django.templatetags.%s" % library_name.split('.')[-1])
except template.InvalidTemplateLibrary:
lib = template.get_library(library_name)
except template.InvalidTemplateLibrary, e:
pass
def get_return_data_type(func_name):