Trac-如何在ITicketChangeListener中访问自定义票证字段? [英] Trac - How do I access Custom Ticket Fields in ITicketChangeListener?

查看:214
本文介绍了Trac-如何在ITicketChangeListener中访问自定义票证字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写自己的 Trac ="nofollow"> ITicketChangeListener接口.

方法定义都非常简单,但是对我来说不简单的是解决方案

有关自定义票证字段的消息来源有误.按名称的值方法应该起作用. * old_values *包含所有字段值,也包括自定义字段.就是这样.

您可能需要查看 TracAnnouncer 一些变更侦听器编码示例的来源.

I'm trying to write my own Trac plugin to notify an external system of changes to tickets matching a certain criteria. From my research so far, I've figured out that implementing the ITicketChangeListener interface is the way to go.

The method definitions are all very straight forward, but what's not straight forward for me is the Ticket object and accessing its custom fields. I've learned that you can access default ticket fields as simply as:

# t is a Ticket object
theStatus = t['status']

I've found several sources that say this won't work:

myCustomField = t['my_custom_field']

Yet none of them tell me what will work.

In addition, I need to know if the old_values argument of the ticket_changed() method will have my custom fields or if I'll have to do something different there as well.

I'm fairly new to Python and very new to Trac. Any help to point me in the right direction is appreciated.

解决方案

The sources are wrong about custom ticket fields. The value-by-name approach should work. And *old_values* contains all fields values, including custom fields too. That's it.

You may want to look at the TracAnnouncer source for some change-listener coding examples.

这篇关于Trac-如何在ITicketChangeListener中访问自定义票证字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆