Commit a2c4010b by Piotr Mitros

Removed caching for dev machines

parent a8c2c3c5
......@@ -151,7 +151,13 @@ def user_groups(user):
# TODO: Rewrite in Django
key = 'user_group_names_{user.id}'.format(user=user)
cache_expiration = 60 * 60 # one hour
group_names = cache.get(fasthash(key))
# Kill caching on dev machines -- we switch groups a lot
if "dev" not in setting.DEFAULT_GROUPS:
group_names = cache.get(fasthash(key))
else:
group_names = None
if group_names is None:
group_names = [u.name for u in UserTestGroup.objects.filter(users=user)]
cache.set(fasthash(key), group_names, cache_expiration)
......
......@@ -6,6 +6,7 @@ import tempfile
import djcelery
# from settings2.askbotsettings import LIVESETTINGS_OPTIONS
DEFAULT_GROUPS = []
# Configuration option for when we want to grab server error pages
STATIC_GRAB = False
......
......@@ -103,3 +103,8 @@ def add_user_to_group(group, user):
utg = UserTestGroup.objects.get(name = group)
utg.users.add(User.objects.get(username = user))
utg.save()
def remove_user_from_group(group, user):
utg = UserTestGroup.objects.get(name = group)
utg.users.add(User.objects.get(username = user))
utg.save()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment