コード例 #1
0
ファイル: __init__.py プロジェクト: alfonsodiecko/PYTHON_DIST
 def _make_metadata(self, data):
     return """\
     <script type="text/javascript">
     var COMMENT_METADATA = %s;
     </script>
     """ % dump_json(
         data
     )
コード例 #2
0
ファイル: __init__.py プロジェクト: alfonsodiecko/PYTHON_DIST
    def _make_comment_options(self, username, moderator):
        """Helper method to create the parts of the COMMENT_OPTIONS
        javascript that are unique to each request.

        :param username: The username of the user making the request.
        :param moderator: Whether the user making the request is a moderator.
        """
        rv = self.base_comment_opts.copy()
        if username:
            rv.update({"voting": True, "username": username, "moderator": moderator})
        return """\
        <script type="text/javascript">
        var COMMENT_OPTIONS = %s;
        </script>
        """ % dump_json(
            rv
        )
コード例 #3
0
    def _make_comment_options(self, username, moderator):
        """Helper method to create the parts of the COMMENT_OPTIONS
        javascript that are unique to each request.

        :param username: The username of the user making the request.
        :param moderator: Whether the user making the request is a moderator.
        """
        rv = self.base_comment_opts.copy()
        if username:
            rv.update({
                'voting': True,
                'username': username,
                'moderator': moderator,
            })
        return '''\
        <script type="text/javascript">
        var COMMENT_OPTIONS = %s;
        </script>
        ''' % dump_json(rv)
コード例 #4
0
 def _make_metadata(self, data):
     return '''\
     <script type="text/javascript">
     var COMMENT_METADATA = %s;
     </script>
     ''' % dump_json(data)