summaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorSam Wenham <sam@wenhams.co.uk>2019-03-30 17:02:07 +0000
committerSam Wenham <sam@wenhams.co.uk>2019-03-30 17:02:07 +0000
commit64a4842dcbcbe10c5edb057c0000659f2809c1f9 (patch)
treea1ee35a80efb0e73ace1bc217de069760396e8f1 /utils.py
parenta4532a29da6c2a92553daeafbd3c7eca5b42f861 (diff)
downloadtroggle-64a4842dcbcbe10c5edb057c0000659f2809c1f9.tar.gz
troggle-64a4842dcbcbe10c5edb057c0000659f2809c1f9.tar.bz2
troggle-64a4842dcbcbe10c5edb057c0000659f2809c1f9.zip
Remove the redundant render_with_context() as django now does this just with the
render() shortcut Move from mimetype to content_type, missed in last commit
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py16
1 files changed, 1 insertions, 15 deletions
diff --git a/utils.py b/utils.py
index a91a1aa..d5deeda 100644
--- a/utils.py
+++ b/utils.py
@@ -1,4 +1,5 @@
from django.conf import settings
+from django.shortcuts import render
import random, re, logging
from troggle.core.models import CaveDescription
@@ -58,21 +59,6 @@ def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}):
if not created and not instance.new_since_parsing:
logging.info(str(instance) + " existed in the database unchanged since last parse. It was overwritten by the current script. \n")
return (instance, created)
-
-def render_with_context(req, *args, **kwargs):
- """this is the snippet from http://www.djangosnippets.org/snippets/3/
-
- Django uses Context, not RequestContext when you call render_to_response.
- We always want to use RequestContext, so that django adds the context from
- settings.TEMPLATE_CONTEXT_PROCESSORS. This way we automatically get
- necessary settings variables passed to each template. So we use a custom
- method, render_response instead of render_to_response. Hopefully future
- Django releases will make this unnecessary."""
-
- from django.shortcuts import render_to_response
- from django.template import RequestContext
- kwargs['context_instance'] = RequestContext(req)
- return render_to_response(*args, **kwargs)
re_body = re.compile(r"\<body[^>]*\>(.*)\</body\>", re.DOTALL)
re_title = re.compile(r"\<title[^>]*\>(.*)\</title\>", re.DOTALL)