AresHtmlTable.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:python-ares 作者: pynog 项目源码 文件源码
def callBackCreateUrl(self, dstColIndex, scriptName, extraCols=None, fixedParams=None):
    """

    :param dstColIndex: The index of the main column with the hyperlink
    :param scriptName: The script name to be called
    :param extraCols: The list with the extra columns Index to be added to the URL
    :return:
    """
    url = render_template_string('''{{ url_for('ares.run_report', report_name='%s', script_name='%s') }}''' % (self.aresObj.reportName, scriptName))
    xtraParams = ''
    if fixedParams is not None:
      xtraParams = "&%s" % "&".join(fixedParams)
    self.callBacks('createdRow', '''
      var content = $('td', row).eq(%(colIndex)s).html() ;
      var extraCols = %(extraCols)s ; var header = %(header)s ; var colsVar = [] ; var contentUrl = content;
      if (extraCols != null) {
        for (var item in extraCols) {
          var colNum = extraCols[item]; colsVar.push(header[colNum].key + "=" + $('td', row).eq(colNum).html())} ;
        contentUrl = content + "&" + colsVar.join('&') ;}
      contentUrl = contentUrl + '%(xtraParams)s' ;
      $('td', row).eq(%(colIndex)s).html("<a href='%(url)s?%(col)s="+ contentUrl + "'>" + content + "</a>")
      ''' % {'colIndex': dstColIndex, 'extraCols': json.dumps(extraCols), 'header': json.dumps(self.header[-1]),
             'xtraParams': xtraParams, 'url': url, 'col': self.recKey(self.header[-1][dstColIndex])})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号