Пример #1
0
    def get(self):

        page = 0
        try:
            page = int(self.request.get("page"))
        except:
            pass

        video_key = self.request.get("video_key")
        playlist_key = self.request.get("playlist_key")
        qa_expand_id = int(self.request.get(
            "qa_expand_id")) if self.request.get("qa_expand_id") else -1
        video = db.get(video_key)
        playlist = db.get(playlist_key)

        if video:
            template_values = video_qa_context(video, playlist, page,
                                               qa_expand_id)
            path = os.path.join(os.path.dirname(__file__), 'video_qa.html')
            html = render_block_to_string(path, 'questions', template_values)
            json = simplejson.dumps({
                "html": html,
                "page": page
            },
                                    ensure_ascii=False)
            self.response.out.write(json)

        return
Пример #2
0
    def get(self):

        question_key = self.request.get("question_key")
        question = db.get(question_key)

        if question:
            answer_query = models_discussion.Feedback.gql("WHERE types = :1 AND targets = :2 AND deleted = :3 ORDER BY date", models_discussion.FeedbackType.Answer, question.key(), False)
            template_values = {
                "answers": answer_query,
                "is_mod": is_current_user_moderator()
            }
            path = os.path.join(os.path.dirname(__file__), 'question_answers.html')
            html = render_block_to_string(path, 'answers', template_values)
            json = simplejson.dumps({"html": html}, ensure_ascii=False)
            self.response.out.write(json)

        return
Пример #3
0
    def get(self):

        question_key = self.request.get("question_key")
        question = db.get(question_key)

        if question:
            answer_query = models_discussion.Feedback.gql("WHERE types = :1 AND targets = :2 AND deleted = :3 ORDER BY date", models_discussion.FeedbackType.Answer, question.key(), False)
            template_values = {
                "answers": answer_query,
                "is_mod": is_current_user_moderator()
            }
            path = os.path.join(os.path.dirname(__file__), 'question_answers.html')
            html = render_block_to_string(path, 'answers', template_values)
            json = simplejson.dumps({"html": html}, ensure_ascii=False)
            self.response.out.write(json)

        return
Пример #4
0
    def get(self):

        page = 0
        try:
            page = int(self.request.get("page"))
        except:
            pass

        video_key = self.request.get("video_key")
        video = db.get(video_key)

        if video:
            comments_hidden = self.request.get("comments_hidden") == "1"
            template_values = video_comments_context(video, page, comments_hidden)
            path = os.path.join(os.path.dirname(__file__), "video_comments.html")

            html = render_block_to_string(path, "comments", template_values)
            json = simplejson.dumps({"html": html, "page": page}, ensure_ascii=False)
            self.response.out.write(json)
Пример #5
0
    def get(self):

        page = 0
        try:
            page = int(self.request.get("page"))
        except:
            pass

        video_key = self.request.get("video_key")
        video = db.get(video_key)

        if video:
            questions_hidden = (self.request.get("questions_hidden") == "1")
            template_values = video_qa_context(video, page, None, questions_hidden)
            path = os.path.join(os.path.dirname(__file__), 'video_qa.html')
            html = render_block_to_string(path, 'questions', template_values)
            json = simplejson.dumps({"html": html, "page": page}, ensure_ascii=False)
            self.response.out.write(json)

        return
Пример #6
0
    def get(self):

        page = 0
        try:
            page = int(self.request.get("page"))
        except:
            pass

        video_key = self.request.get("video_key")
        playlist_key = self.request.get("playlist_key")
        video = db.get(video_key)
        playlist = db.get(playlist_key)

        if video:
            comments_hidden = (self.request.get("comments_hidden") == "1")
            template_values = video_comments_context(video, playlist, page, comments_hidden)
            path = os.path.join(os.path.dirname(__file__), 'video_comments.html')

            html = render_block_to_string(path, 'comments', template_values)
            json = simplejson.dumps({"html": html, "page": page}, ensure_ascii=False)
            self.response.out.write(json)
Пример #7
0
    def get(self):

        page = 0
        try:
            page = int(self.request.get("page"))
        except:
            pass

        video_key = self.request.get("video_key")
        playlist_key = self.request.get("playlist_key")
        qa_expand_id = int(self.request.get("qa_expand_id")) if self.request.get("qa_expand_id") else -1
        video = db.get(video_key)
        playlist = db.get(playlist_key)

        if video:
            template_values = video_qa_context(video, playlist, page, qa_expand_id)
            path = os.path.join(os.path.dirname(__file__), 'video_qa.html')
            html = render_block_to_string(path, 'questions', template_values)
            json = simplejson.dumps({"html": html, "page": page}, ensure_ascii=False)
            self.response.out.write(json)

        return
Пример #8
0
def render_graph_html_and_context(filename, context):
    path = os.path.join(os.path.dirname(__file__), filename)
    return {
        "html": render_block_to_string(path, 'graph', context),
        "context": context
    }
Пример #9
0
def render_graph_html_and_context(filename, context):
    path = os.path.join(os.path.dirname(__file__), filename)
    return {"html": render_block_to_string(path, 'graph', context), "context": context}