X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/410bfa05ee36ed1d99356c443a5f3f6aa3ee9578..7395cbba715aeda5b5d0927f33d4949b05803865:/forum/modules/__init__.py diff --git a/forum/modules/__init__.py b/forum/modules/__init__.py index 023b464..cbac6ed 100644 --- a/forum/modules/__init__.py +++ b/forum/modules/__init__.py @@ -1,6 +1,7 @@ import os import types import re +import logging from django.template import Template, TemplateDoesNotExist from django.conf import settings @@ -25,13 +26,19 @@ def get_modules_script(script_name): for m in MODULE_LIST: try: all.append(__import__('%s.%s' % (m.__name__, script_name), globals(), locals(), [m.__name__])) - except Exception, e: - #print m.__name__ + ":" + str(e) + except ImportError, e: + #print repr(type(e)) + m.__name__ + ":" + str(e) pass + except: + import traceback + msg = "Error importing %s from module %s: \n %s" % ( + script_name, m.__name__, traceback.format_exc() + ) + logging.error(msg) return all -def get_modules_scipt_implementations(script_name, impl_class): +def get_modules_script_implementations(script_name, impl_class): scripts = get_modules_script(script_name) all_impls = {} @@ -101,3 +108,5 @@ def module_templates_loader(name, dirs=None): raise TemplateDoesNotExist, name module_templates_loader.is_usable = True + +from decorators import decorate, ReturnImediatelyException