Re: Genshi能载入第三方html页面吗?

14 views
Skip to first unread message

Zoom.Quiet

unread,
Jun 19, 2012, 3:17:44 AM6/19/12
to 任我飞, trach...@googlegroups.com, Qing Feng
在 2012年6月19日 下午3:11,任我飞 <renwo...@gmail.com> 写道:
> 最近一直在改造trac给公司用,最近想实现一个导航栏,自己写了个应用,返回一个导航栏,本来指望用:
> <iframe src="http://127.0.0.1:8000/return_menu" width=100%
> height=35px></iframe>
> 结果在trac中一试,报错:
>
> File
> "/root/trac/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg/genshi/template/base.py",
> line 408, in __init__
> raise TemplateSyntaxError(e.msg, self.filepath, e.lineno, e.offset)
> TemplateSyntaxError: not well-formed (invalid token): line 16, column 59
> (/root/trac/njqz/templates/site.html, line 16)
>
>
> 上网一查,发现http://trac.edgewall.org/ticket/3416 可能不支持。上网找了半天也没有找到好的方法。
>
>
> 请教下,有什么其他方法吗?或者如何禁用trac这种模板检查?

- 抄发相关列表,以及 豆瓣工程师(豆瓣是资深 Trac 大户)
- 一般不涉及 Trac 自身 wiki/ticket 数据交互的,不用写 app,直接修订模板,作为 html 嵌入输出就好
- 俺没有写过 trac 插件,一时,也想不出有什么好方法
- 另外,从俺在金山推广 Trac 的体验而言:
- 不接受 Trac 的维基式简洁流程以及形式的团队
- 强推很难推起来的,这时 Redmine 这种更加接近 Project 界面的,比较容易为所有人接受...


--
人生苦短, Pythonic! 冗余不做,日子甭过!备份不做,十恶不赦!
俺: http://about.me/zoom.quiet
文字协议: http://creativecommons.org/licenses/by-sa/2.5/cn/

Richard Liao

unread,
Jun 19, 2012, 10:32:23 PM6/19/12
to trach...@googlegroups.com, 任我飞, Qing Feng
我是这样增加导航栏的:
{{{
class MyPlugin(Component):

implements(
IRequestHandler,
INavigationContributor,
)

# INavigationContributor methods

def get_active_navigation_item(self, req):
return 'myplugin'

def get_navigation_items(self, req):
if not req.perm.has_permission('MYPLUGIN_VIEW'):
return
yield ('mainnav', 'myplugin',
html.A(u'我的插件', href= req.href()))

# IRequestHandler methods

def match_request(self, req):
return req.path_info.startswith('/myplugin')

def process_request(self, req):
req.perm.assert_permission('MYPLUGIN_VIEW')
# 下面是插件由生成页面
}}}

如果要调整导航栏的顺序,修改trac.ini
{{{
[trac]
mainnav = myplugin,wiki,timeline,roadmap,browser,tickets,newticket,search
}}}

2012/6/19 Zoom.Quiet <zoom....@gmail.com>:

> --
> 邮件来自: Google 论坛"TraChinese"论坛。
> 发言: trach...@googlegroups.com
> 退订: trachinese-...@googlegroups.com
> 详细: http://groups.google.com/group/trachinese
> 工程: http://trac-hacks.org/wiki/TracChineseTranslation

--
Richard Liao

renwofei423

unread,
Jun 27, 2012, 1:52:35 AM6/27/12
to TraChinese
最后问题解决了,是iframe编写不规范导致。
修改的思路是启用模板,修改trac.ini 中:
[inherit]
templates_dir = templates/

然后在项目中的templates/目录中建立site.html文件,在头部分插入iframe:
<iframe src="http://www.test.com/return_menu" frameborder="0"
scrolling="no" styple="width:100%;height:40px"></iframe>

On Jun 20, 10:32 am, Richard Liao <richard.lia...@gmail.com> wrote:
> 我是这样增加导航栏的:
> {{{
> class MyPlugin(Component):
>
> implements(
> IRequestHandler,
> INavigationContributor,
> )
>
> # INavigationContributor methods
>
> def get_active_navigation_item(self, req):
> return 'myplugin'
>
> def get_navigation_items(self, req):
> if not req.perm.has_permission('MYPLUGIN_VIEW'):
> return
> yield ('mainnav', 'myplugin',
> html.A(u'我的插件', href= req.href()))
>
> # IRequestHandler methods
>
> def match_request(self, req):
> return req.path_info.startswith('/myplugin')
>
> def process_request(self, req):
> req.perm.assert_permission('MYPLUGIN_VIEW')
> # 下面是插件由生成页面
>
> }}}
>
> 如果要调整导航栏的顺序,修改trac.ini
> {{{
> [trac]
> mainnav = myplugin,wiki,timeline,roadmap,browser,tickets,newticket,search
>
> }}}
>

> 2012/6/19 Zoom.Quiet <zoom.qu...@gmail.com>:


>
>
>
>
>
>
>
>
>
> > 在 2012年6月19日 下午3:11,任我飞 <renwofei...@gmail.com> 写道:
> >> 最近一直在改造trac给公司用,最近想实现一个导航栏,自己写了个应用,返回一个导航栏,本来指望用:
> >> <iframe src="http://127.0.0.1:8000/return_menu" width=100%
> >> height=35px></iframe>
> >> 结果在trac中一试,报错:
>
> >> File

> >> "/root/trac/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg/genshi/templat e/base.py",


> >> line 408, in __init__
> >> raise TemplateSyntaxError(e.msg, self.filepath, e.lineno, e.offset)
> >> TemplateSyntaxError: not well-formed (invalid token): line 16, column 59
> >> (/root/trac/njqz/templates/site.html, line 16)
>

> >> 上网一查,发现http://trac.edgewall.org/ticket/3416可能不支持。上网找了半天也没有找到好的方法。

Reply all
Reply to author
Forward
0 new messages