Commit 98f5a79d by Piotr Mitros

Disabled profile cache -- we ran into issues

parent cb24b172
...@@ -58,6 +58,11 @@ def get_instance(model, instance_or_pk, timeout=None, using=None): ...@@ -58,6 +58,11 @@ def get_instance(model, instance_or_pk, timeout=None, using=None):
cache.delete(key) cache.delete(key)
# Use the default manager so we are never filtered by a .get_query_set() # Use the default manager so we are never filtered by a .get_query_set()
# import logging
# log = logging.getLogger("tracking")
# log.info( str(pk) )
instance = model._default_manager.using(using).get(pk=pk) instance = model._default_manager.using(using).get(pk=pk)
data = {} data = {}
......
...@@ -92,6 +92,10 @@ def cache_relation(descriptor, timeout=None): ...@@ -92,6 +92,10 @@ def cache_relation(descriptor, timeout=None):
except AttributeError: except AttributeError:
pass pass
# import logging
# log = logging.getLogger("tracking")
# log.info( "DEBUG: "+str(str(rel.model)+"/"+str(self.pk) ))
instance = get_instance(rel.model, self.pk, timeout) instance = get_instance(rel.model, self.pk, timeout)
setattr(self, '_%s_cache' % related_name, instance) setattr(self, '_%s_cache' % related_name, instance)
......
...@@ -169,7 +169,11 @@ def course_xml_process(tree): ...@@ -169,7 +169,11 @@ def course_xml_process(tree):
def course_file(user): def course_file(user):
''' Given a user, return course.xml''' ''' Given a user, return course.xml'''
filename = user.profile_cache.courseware # UserProfile.objects.get(user=user).courseware #import logging
#log = logging.getLogger("tracking")
#log.info( "DEBUG: cf:"+str(user) )
filename = UserProfile.objects.get(user=user).courseware # user.profile_cache.courseware
groups = user_groups(user) groups = user_groups(user)
options = {'dev_content':settings.DEV_CONTENT, options = {'dev_content':settings.DEV_CONTENT,
'groups' : groups} 'groups' : groups}
......
...@@ -254,7 +254,7 @@ def profile(request): ...@@ -254,7 +254,7 @@ def profile(request):
] ]
user_info = request.user.profile_cache # UserProfile.objects.get(user=request.user) user_info = UserProfile.objects.get(user=request.user) # request.user.profile_cache #
context={'name':user_info.name, context={'name':user_info.name,
'username':request.user.username, 'username':request.user.username,
'location':user_info.location, 'location':user_info.location,
...@@ -345,6 +345,10 @@ def index(request, course="6.002 Spring 2012", chapter="Using the System", secti ...@@ -345,6 +345,10 @@ def index(request, course="6.002 Spring 2012", chapter="Using the System", secti
if course!="6.002 Spring 2012": if course!="6.002 Spring 2012":
return redirect('/') return redirect('/')
#import logging
#log = logging.getLogger("mitx")
#log.info( "DEBUG: "+str(user) )
dom = content_parser.course_file(user) dom = content_parser.course_file(user)
dom_module = dom.xpath("//course[@name=$course]/chapter[@name=$chapter]//section[@name=$section]/*[1]", dom_module = dom.xpath("//course[@name=$course]/chapter[@name=$chapter]//section[@name=$section]/*[1]",
course=course, chapter=chapter, section=section) course=course, chapter=chapter, section=section)
......
...@@ -56,4 +56,4 @@ class Registration(models.Model): ...@@ -56,4 +56,4 @@ class Registration(models.Model):
self.user.save() self.user.save()
#self.delete() #self.delete()
cache_relation(User.profile) #cache_relation(User.profile)
...@@ -86,7 +86,7 @@ def logout_user(request): ...@@ -86,7 +86,7 @@ def logout_user(request):
def change_setting(request): def change_setting(request):
if not request.user.is_authenticated(): if not request.user.is_authenticated():
return redirect('/') return redirect('/')
up = request.user.profile_cache # UserProfile.objects.get(user=request.user) up = UserProfile.objects.get(user=request.user) #request.user.profile_cache
if 'location' in request.POST: if 'location' in request.POST:
# print "loc" # print "loc"
up.location=request.POST['location'] up.location=request.POST['location']
......
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