diff options
author | Wookey <wookey@wookware.org> | 2019-04-02 00:57:54 +0100 |
---|---|---|
committer | Wookey <wookey@wookware.org> | 2019-04-02 00:57:54 +0100 |
commit | c4301cf6df56ba1bef4f2c908b949a2b45ea65dc (patch) | |
tree | 9c6bb4a4530824c8e072984a0346509298188030 /utils.py | |
parent | de7d68b1eb70542f66092cb0048af3d096e6980c (diff) | |
parent | bb8dbb381fe87c3a63e9586a1bf1e993b09c965b (diff) | |
download | troggle-c4301cf6df56ba1bef4f2c908b949a2b45ea65dc.tar.gz troggle-c4301cf6df56ba1bef4f2c908b949a2b45ea65dc.tar.bz2 troggle-c4301cf6df56ba1bef4f2c908b949a2b45ea65dc.zip |
Merge lots of troggle fixes
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 16 |
1 files changed, 1 insertions, 15 deletions
@@ -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) |