<s> from importlib import import_module <EOL> from django . core . urlresolvers import set_urlconf <EOL> from django . dispatch import receiver <EOL> from django . conf import settings <EOL> from widgy . signals import widgy_pre_index <EOL> @ receiver ( widgy_pre_index ) <EOL> def patch_url_conf ( sender , ** kwargs ) : <EOL> from . middleware import PatchUrlconfMiddleware <EOL> root_urlconf = import_module ( settings . ROOT_URLCONF ) <EOL> urlconf = PatchUrlconfMiddleware . get_urlconf ( root_urlconf ) <EOL> set_urlconf ( urlconf ) </s>
