Exemple #1
0
def patch_root_urlconf():
    try:
        reverse('djdt:render_panel')
    except NoReverseMatch:
        urlconf_module = import_module(settings.ROOT_URLCONF)
        urlconf_module.urlpatterns += patterns('',                      # noqa
            url(r'^__debug__/', include(debug_toolbar.urls)),
        )
        _resolver_cache.clear()
        _ns_resolver_cache.clear()
    def __getattr__(self, name):
        try:
            plugin_patterns = PLUGIN_URLS_SYNC_DICT["plugin_patterns"]
        except KeyError:
            # First time started or django-tools local sync cache was cleared
            # in this thread or in a other thread.

            log.debug("Clear django.core.urlresolvers cache")
            _resolver_cache.clear()  # Maps URLconf modules to RegexURLResolver instances.
            _ns_resolver_cache.clear()  # Maps namespaces to RegexURLResolver instances.
            _callable_cache.clear()  # Maps view and url pattern names to their view functions.

            # get the plugin url patterns fresh
            plugin_patterns = self._get_plugin_patterns()
            PLUGIN_URLS_SYNC_DICT["plugin_patterns"] = plugin_patterns

        return getattr(plugin_patterns, name)
Exemple #3
0
    def __getattr__(self, name):
        try:
            plugin_patterns = PLUGIN_URLS_SYNC_DICT["plugin_patterns"]
        except KeyError:
            # First time started or django-tools local sync cache was cleared
            # in this thread or in a other thread.

            log.debug("Clear django.core.urlresolvers cache")
            _resolver_cache.clear(
            )  # Maps URLconf modules to RegexURLResolver instances.
            _ns_resolver_cache.clear(
            )  # Maps namespaces to RegexURLResolver instances.
            _callable_cache.clear(
            )  # Maps view and url pattern names to their view functions.

            # get the plugin url patterns fresh
            plugin_patterns = self._get_plugin_patterns()
            PLUGIN_URLS_SYNC_DICT["plugin_patterns"] = plugin_patterns

        return getattr(plugin_patterns, name)