diff --git a/cache_toolbox/core.py b/cache_toolbox/core.py index 8abc16c7be..b2802e7fec 100644 --- a/cache_toolbox/core.py +++ b/cache_toolbox/core.py @@ -58,6 +58,11 @@ def get_instance(model, instance_or_pk, timeout=None, using=None): cache.delete(key) # 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) data = {} diff --git a/cache_toolbox/relation.py b/cache_toolbox/relation.py index eae7d93f6f..38d985aa94 100644 --- a/cache_toolbox/relation.py +++ b/cache_toolbox/relation.py @@ -92,6 +92,10 @@ def cache_relation(descriptor, timeout=None): except AttributeError: 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) setattr(self, '_%s_cache' % related_name, instance) diff --git a/courseware/content_parser.py b/courseware/content_parser.py index 190a63fba7..30b8c1753b 100644 --- a/courseware/content_parser.py +++ b/courseware/content_parser.py @@ -169,7 +169,11 @@ def course_xml_process(tree): def course_file(user): ''' 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) options = {'dev_content':settings.DEV_CONTENT, 'groups' : groups} diff --git a/courseware/views.py b/courseware/views.py index 3a1835e1bd..876c0563e1 100644 --- a/courseware/views.py +++ b/courseware/views.py @@ -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, 'username':request.user.username, 'location':user_info.location, @@ -345,6 +345,10 @@ def index(request, course="6.002 Spring 2012", chapter="Using the System", secti if course!="6.002 Spring 2012": return redirect('/') + #import logging + #log = logging.getLogger("mitx") + #log.info( "DEBUG: "+str(user) ) + dom = content_parser.course_file(user) dom_module = dom.xpath("//course[@name=$course]/chapter[@name=$chapter]//section[@name=$section]/*[1]", course=course, chapter=chapter, section=section) diff --git a/student/models.py b/student/models.py index 8c9a71c753..d12d2e4aae 100644 --- a/student/models.py +++ b/student/models.py @@ -56,4 +56,4 @@ class Registration(models.Model): self.user.save() #self.delete() -cache_relation(User.profile) +#cache_relation(User.profile) diff --git a/student/views.py b/student/views.py index 5e3cb7b9b0..b8194b3e61 100644 --- a/student/views.py +++ b/student/views.py @@ -86,7 +86,7 @@ def logout_user(request): def change_setting(request): if not request.user.is_authenticated(): 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: # print "loc" up.location=request.POST['location']