本文整理汇总了Python中trac.ticket.model.Ticket.status方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.status方法的具体用法?Python Ticket.status怎么用?Python Ticket.status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.model.Ticket
的用法示例。
在下文中一共展示了Ticket.status方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _import_trackers
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import status [as 别名]
def _import_trackers(self, meta, reset):
types = set()
components = set()
priorities = set()
resolutions = set()
for tracker in meta["trackers"]:
types.add(tracker["label"])
v = tracker["vocabulary"]
for x in v.get("Category", []):
components.add(x)
for x in v.get("priority", []):
priorities.add(x)
for x in v.get("Resolution", []):
resolutions.add(x)
if reset:
@self.env.with_transaction()
def do_reset_components(db):
cursor = db.cursor()
cursor.execute("DELETE FROM component")
cursor.execute("DELETE FROM milestone")
cursor.execute("DELETE FROM enum")
cursor.execute("DELETE FROM version")
cursor.execute("DELETE FROM ticket")
cursor.execute("DELETE FROM ticket_change")
@self.env.with_transaction()
def do_reset_ticket_meta(db):
cursor = db.cursor()
for x in sorted(components):
cursor.execute("INSERT INTO component (name, owner, description) VALUES (%s, 'admin', %s)", (x, x))
for i, x in enumerate(sorted(types)):
cursor.execute("INSERT INTO enum (type, name, value) VALUES ('ticket_type', %s, %s)", (x, i + 1))
for i, x in enumerate(sorted(priorities)):
cursor.execute("INSERT INTO enum (type, name, value) VALUES ('priority', %s, %s)", (x, i + 1))
for i, x in enumerate(sorted(resolutions)):
cursor.execute("INSERT INTO enum (type, name, value) VALUES ('resolution', %s, %s)", (x, i + 1))
for tracker in meta["trackers"]:
label = tracker["label"]
for a in tracker["artifacts"]:
owner = a.get("assigned_to", "")
if owner == "Nobody" or owner == "No Change":
owner = ""
ticket = Ticket(self.env) # , a['id'])
ticket.populate(
{
"summary": a.get("summary", ""),
"reporter": a.get("submitter", ""),
"description": a.get("description", ""),
"type": label,
"priority": a.get("priority", ""),
"component": a.get("Category", ""),
"owner": owner,
"status": a.get("status", ""),
"cc": "",
"keywords": "",
}
)
created = dateutil.parser.parse(a["date"])
ticket.insert(created)
changes = a["comments"]
changes.extend(a["history"])
lastcom = None
for c in sorted(changes, key=lambda x: x["date"]):
modified = dateutil.parser.parse(c["date"])
if c["class"] == "COMMENT":
author = c.get("submitter", "")
comment = c.get("comment", "")
if lastcom != None and lastcom == modified:
modified += datetime.timedelta(0, 10)
lastcom = modified
elif c["class"] == "FIELDCHANGE":
author = c["by"]
comment = None
field = c["field"]
value = c["old"] # WTF?
if field == "status":
ticket.status = value
elif field == "Resolution":
ticket.resolution = value
elif field == "assigned_to":
ticket.owner = value
elif field == "close_date":
continue
ticket.save_changes(author, comment, modified)
return "OK"