# HG changeset patch # User ymh # Date 1328832332 -3600 # Node ID 6fbf608bd2a7826e12e2b83d032c3ee06967d264 # Parent c447d863b6ad1679f7a27602b616af0d7e903cc2 put external stream in settings diff -r c447d863b6ad -r 6fbf608bd2a7 src/ldt/ldt/ldt_utils/views/front.py --- a/src/ldt/ldt/ldt_utils/views/front.py Thu Feb 09 22:17:34 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/views/front.py Fri Feb 10 01:05:32 2012 +0100 @@ -12,9 +12,9 @@ def front_home(request): # Get the 3 last annotated contents - last_contents = Content.objects.order_by('-last_annotated').exclude(nb_annotation=0)[:3] + last_contents = Content.objects.order_by('-stat_annotation__last_annotated').exclude(stat_annotation__nb_annotation=0)[:3] # Get the most annotated contents - most_contents = Content.objects.order_by('-nb_annotation')[:8] + most_contents = Content.objects.order_by('-stat_annotation__nb_annotations')[:8] # Get the active groups active_groups = Group.objects.exclude(name=settings.PUBLIC_GROUP_NAME)[:5] # Get the main tag list @@ -73,8 +73,11 @@ content = Content.objects.get(iri_id=content_iri_id) # Get the content src to see if it is a youtube/dailymotion video external_url = None - if content.src is not None and (("youtube.com" in content.src) or ("dailymotion.com" in content.src)): - external_url = content.src + if content.src is not None: + for external_src in settings.EXTERNAL_STREAM_SRC: + if external_src in content.src: + external_url = content.src + break # If project id is not set, we get the default project for the content if project_id is None or project_id == "_": diff -r c447d863b6ad -r 6fbf608bd2a7 src/ldt/ldt/settings.py --- a/src/ldt/ldt/settings.py Thu Feb 09 22:17:34 2012 +0100 +++ b/src/ldt/ldt/settings.py Fri Feb 10 01:05:32 2012 +0100 @@ -93,3 +93,5 @@ DEFAULT_PROJECT_ICON = "thumbnails/projects/project_default_icon.png" DEFAULT_USER_ICON = "thumbnails/users/user_default_icon.png" DEFAULT_GROUP_ICON = "thumbnails/groups/group_default_icon.png" + +EXTERNAL_STREAM_SRC = getattr(settings, 'EXTERNAL_STREAM_SRC', ['youtube.com', 'dailymotion.com']) \ No newline at end of file diff -r c447d863b6ad -r 6fbf608bd2a7 web/ldtplatform/settings.py --- a/web/ldtplatform/settings.py Thu Feb 09 22:17:34 2012 +0100 +++ b/web/ldtplatform/settings.py Fri Feb 10 01:05:32 2012 +0100 @@ -238,6 +238,7 @@ '??' : 'Q' } +EXTERNAL_STREAM_SRC = ['youtube.com', 'dailymotion.com'] from config import *