自己的文件导出选项只打印第一个字符(Trac 插件)

Own file export option only prints the first character (Trac plugin)

我编写了一个 Trac 插件,它向自定义查询模块添加了另一个导出选项。到目前为止,该插件本身可以正常工作,但我 运行 遇到了一个问题,当我单击 以其他格式下载 部分中的 link 时,仅第一个字符显示为打印出来。

出于测试目的,我让 IContentConverter return 的 convert_content 方法成为一个简单的字符串。

但是无论字符串的内容是什么,只打印第一个字符。

示例:

If the string says test, clicking the link opens a new tab with only the letter t.

If the string says asdf, clicking the link opens a new tab with only the letter a.

Trac 是否希望我 return 一个接一个地完成所有角色?

已修复。我在 Trac 源中查找了 csv 导出的实现,并意识到我需要 return 一个包含实际结果和 mimetype 的元组。

这是 csv 导出的部分:

return iterate(), '%s;charset=utf-8' % mimetype

虽然我不知道为什么它没有抛出错误。也许这是 Trac 中的一个错误,它在没有给出 mimetype 时打印 returned 字符串的第一个字母。