From 8cd7a8296f6698d7b3e1d322c9626d816e86b900 Mon Sep 17 00:00:00 2001 From: Clay McClure Date: Mon, 28 May 2012 00:11:06 -0300 Subject: [PATCH] Fix ImportError while importing django's `render_to_string` --- djangosphinx/config.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/djangosphinx/config.py b/djangosphinx/config.py index 4b8f69f..079bb83 100644 --- a/djangosphinx/config.py +++ b/djangosphinx/config.py @@ -13,20 +13,11 @@ assert getattr(settings, 'SPHINX_ROOT', None) is not None, "You must specify `SPHINX_ROOT` in your settings." -from django.template import RequestContext - if 'coffin' in settings.INSTALLED_APPS: import jinja2 - from coffin import shortcuts + from coffin.shortcuts import render_to_string else: - from django import shortcuts - -def render_to_string(template, context, request=None): - if request: - context_instance = RequestContext(request) - else: - context_instance = None - return shortcuts.render_to_string(template, context, context_instance) + from django.template.loader import render_to_string def relative_path(*args): return os.path.abspath(os.path.join(settings.SPHINX_ROOT, *args)) @@ -36,6 +27,7 @@ def relative_path(*args): 'SPHINX_PORT': getattr(settings, 'SPHINX_PORT', '3312'), 'relative_path': relative_path, } + if getattr(settings, 'DATABASES', None): context.update({ 'DATABASE_HOST': settings.DATABASES['default']['HOST'],