summaryrefslogtreecommitdiffstats
path: root/lib/utils.py
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2008-03-08 09:13:41 +0100
committereliott <eliott@cactuswax.net>2008-03-08 09:13:41 +0100
commit9b7b5122544283fc32d81d785e94c5f4aacc0109 (patch)
treeba117f7fadc24737920fa4f1b9a711157e629cc5 /lib/utils.py
parent7e2d0f2f0cd8f176cf82c02d704ad4fe25a07b3b (diff)
downloadarchweb-9b7b5122544283fc32d81d785e94c5f4aacc0109.tar.gz
archweb-9b7b5122544283fc32d81d785e94c5f4aacc0109.tar.xz
Moved models around
Diffstat (limited to 'lib/utils.py')
-rw-r--r--lib/utils.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/lib/utils.py b/lib/utils.py
deleted file mode 100644
index 0813ac2..0000000
--- a/lib/utils.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from django.core import validators
-from django.conf import settings
-from django.core.cache import cache
-from django.shortcuts import render_to_response
-from django.template import RequestContext
-
-def validate(errdict, fieldname, fieldval, validator, blankallowed, request):
- """
- A helper function that allows easy access to Django's validators without
- going through a Manipulator object. Will return a dict of all triggered
- errors.
- """
- if blankallowed and not fieldval:
- return
- alldata = ' '.join(request.POST.values()) + ' '.join(request.GET.values())
- try:
- validator(fieldval, alldata)
- except validators.ValidationError, e:
- if not errdict.has_key(fieldname):
- errdict[fieldname] = []
- errdict[fieldname].append(e)
-
-def prune_cache(django_page_url):
- if not settings.CACHE:
- return
- cache_prefix = 'views.decorators.cache.cache_page.'
- cache_prefix += settings.CACHE_MIDDLEWARE_KEY_PREFIX + '.'
- cache_postfix = '.d41d8cd98f00b204e9800998ecf8427e'
- cache.delete('%s%s%s' % (cache_prefix,django_page_url,cache_postfix))
-
-def render_response(req, *args, **kwargs):
- kwargs['context_instance'] = RequestContext(req)
- return render_to_response(*args, **kwargs)
-
-# vim: set ts=4 sw=4 et:
-