# HG changeset patch # User verrierj # Date 1328203784 -3600 # Node ID 2ae1a476a69d924b665e5f68378adab05494b8da # Parent 1166fb6bc9b485ccdff04c9657c40bc884d1440c Medias with no annotations are not displayed on front home page diff -r 1166fb6bc9b4 -r 2ae1a476a69d src/ldt/ldt/ldt_utils/views/content.py --- a/src/ldt/ldt/ldt_utils/views/content.py Thu Feb 02 17:43:40 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/views/content.py Thu Feb 02 18:29:44 2012 +0100 @@ -215,7 +215,6 @@ cached_assign('change_content', request.user, content) cached_assign('view_content', request.user, content) everyone = Group.objects.get(name=settings.PUBLIC_GROUP_NAME) - print content_form.cleaned_data if content_form.cleaned_data['is_public']: cached_assign('view_content', everyone, content) diff -r 1166fb6bc9b4 -r 2ae1a476a69d src/ldt/ldt/ldt_utils/views/front.py --- a/src/ldt/ldt/ldt_utils/views/front.py Thu Feb 02 17:43:40 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/views/front.py Thu Feb 02 18:29:44 2012 +0100 @@ -12,7 +12,7 @@ def front_home(request): # Get the 3 last annotated contents - last_contents = Content.objects.order_by('-last_annotated')[:3] + last_contents = Content.objects.order_by('-last_annotated').exclude(nb_annotation=0)[:3] # Get the most annotated contents most_contents = Content.objects.order_by('-nb_annotation')[:8] # Get the active groups @@ -91,18 +91,13 @@ proj = proj[0] else: proj = Project.safe_objects.get(ldt_id=project_id) - - if not proj.state == 2: # If the original front project is unpublished - content.create_front_project() - proj = content.front_project - - + # Vars for player player_id = "player_project_" + proj.ldt_id if cutting_id is None : json_url = reverse("ldt.ldt_utils.views.json.project_json_id", args=[proj.ldt_id]) - else : + else: json_url = reverse("ldt.ldt_utils.views.json.project_json_cutting_id", args=[proj.ldt_id, cutting_id]) player_width = 550 player_height = 380 diff -r 1166fb6bc9b4 -r 2ae1a476a69d src/ldt/ldt/security/__init__.py --- a/src/ldt/ldt/security/__init__.py Thu Feb 02 17:43:40 2012 +0100 +++ b/src/ldt/ldt/security/__init__.py Thu Feb 02 18:29:44 2012 +0100 @@ -90,8 +90,12 @@ def wrapper(func): def wrapped(self, *args, **kwargs): - if self.pk and not get_current_user().has_perm('change_%s' % cls_name, self): - raise AttributeError('User %s is not allowed to change object %s' % (get_current_user(), self)) + user = get_current_user() + if not user: + user = get_anonymous_user() + + if self.pk and not user.has_perm('change_%s' % cls_name, self): + raise AttributeError('User %s is not allowed to change object %s' % (user, self)) return func(self, *args, **kwargs) return wrapped