/usr/share/pyshared/djapian/utils/loading.py is in python-django-djapian 2.3.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Module taken from Turbion blog engine
import os
import imp
from django.utils.importlib import import_module
class NoModuleError(Exception):
"""
Custom exception class indicates that given module does not exit at all
"""
pass
def get_module(base, module_name):
try:
base_path = __import__(base, {}, {}, [base.split('.')[-1]]).__path__
except AttributeError:
raise NoModuleError("Cannot load base `%s`" % base)
try:
imp.find_module(module_name, base_path)
except ImportError:
raise NoModuleError("Cannot find module `%s` in base `%s`" % (module_name, base))
return import_module('.%s' % module_name, base)
|