Commit 80d68e3d by andreas.pelme

Output error message when a filter is not found


git-svn-id: https://django-compress.googlecode.com/svn/trunk@65 98d35234-f74b-0410-9e22-51d878bdf110
parent 51196b2a
......@@ -12,14 +12,17 @@ def get_filter(compressor_class):
"""
Convert a string version of a function name to the callable object.
"""
if not hasattr(compressor_class, '__bases__'):
try:
compressor_class = compressor_class.encode('ascii')
mod_name, class_name = get_mod_func(compressor_class)
if class_name != '':
compressor_class = getattr(__import__(mod_name, {}, {}, ['']), class_name)
except (ImportError, AttributeError):
pass
raise Exception('Failed to import filter %s' % compressor_class)
return compressor_class
def get_mod_func(callback):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment