diff --git a/pod/video/management/commands/check_obsolete_videos.py b/pod/video/management/commands/check_obsolete_videos.py index cab5481070..4d7e4a1ab2 100644 --- a/pod/video/management/commands/check_obsolete_videos.py +++ b/pod/video/management/commands/check_obsolete_videos.py @@ -24,6 +24,10 @@ CONTACT_US_EMAIL = getattr( settings, 'CONTACT_US_EMAIL', [ mail for name, mail in getattr(settings, 'MANAGERS')]) + +SECURE_SSL_REDIRECT = getattr(settings, 'SECURE_SSL_REDIRECT', False) +URL_SCHEME = "https" if SECURE_SSL_REDIRECT else "http" + ## # Settings exposed in templates # @@ -90,7 +94,7 @@ def get_video_treatment_and_notify_user(self): sites=get_current_site( settings.SITE_ID)) for video in videos: - self.notify_user(video, step_day) + # self.notify_user(video, step_day) if ( USE_ESTABLISHMENT and MANAGERS and @@ -194,8 +198,10 @@ def notify_user(self, video, step_day): msg_html += _( "you can change the removal date " + "by editing your video:

\n" - + "

" - + "http:%(url)s

\n") % { + + "

" + + "%(scheme)s:%(url)s

\n") % { + "scheme": URL_SCHEME, "url": video.get_full_url()} msg_html += "

" + _("Regards") + "

\n" else: @@ -335,20 +341,23 @@ def notify_manager_of_archived_video(self, list_video): def get_list_video_html(self, list_video, deleted): msg_html = "" - for deadline in list_video: + for i, deadline in enumerate(list_video): if deleted is False and deadline != '0': - msg_html += "\n" + if i != 0: + msg_html += "

" + msg_html += "\n" msg_html += _("In %(deadline)s days") % {"deadline": deadline} - msg_html += ":" + msg_html += ":" for vid in list_video[deadline]: if deleted: msg_html += "\n
- " + vid else: msg_html += ( "\n
- %(title)s : " - + "%(url)s.") % { - "url": vid.get_full_url(), "title": vid + + "%(scheme)s:%(url)s.") % { + "scheme": URL_SCHEME, + "url": vid.get_full_url(), "title": vid } return msg_html diff --git a/pod/video/utils.py b/pod/video/utils.py index 81d85dc7ef..828fb47ca4 100644 --- a/pod/video/utils.py +++ b/pod/video/utils.py @@ -41,6 +41,8 @@ MANAGERS = getattr(settings, 'MANAGERS', {}) +SECURE_SSL_REDIRECT = getattr(settings, 'SECURE_SSL_REDIRECT', False) + # ########################################################################## # ENCODE VIDEO : GENERIC FUNCTION @@ -108,7 +110,8 @@ def send_email(msg, video_id): def send_email_transcript(video_to_encode): if DEBUG: print("SEND EMAIL ON TRANSCRIPTING COMPLETION") - content_url = "http:%s" % video_to_encode.get_full_url() + url_scheme = "https" if SECURE_SSL_REDIRECT else "http" + content_url = "%s:%s" % (url_scheme, video_to_encode.get_full_url()) subject = "[%s] %s" % ( TITLE_SITE, _(u"Transcripting #%(content_id)s completed") % { @@ -195,7 +198,8 @@ def send_email_transcript(video_to_encode): def send_email_encoding(video_to_encode): if DEBUG: print("SEND EMAIL ON ENCODING COMPLETION") - content_url = "http:%s" % video_to_encode.get_full_url() + url_scheme = "https" if SECURE_SSL_REDIRECT else "http" + content_url = "%s:%s" % (url_scheme, video_to_encode.get_full_url()) subject = "[%s] %s" % ( TITLE_SITE, _(u"Encoding #%(content_id)s completed") % {