本文整理匯總了Python中trac.ticket.web_ui.TicketModule._insert_ticket_data方法的典型用法代碼示例。如果您正苦於以下問題:Python TicketModule._insert_ticket_data方法的具體用法?Python TicketModule._insert_ticket_data怎麽用?Python TicketModule._insert_ticket_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類trac.ticket.web_ui.TicketModule
的用法示例。
在下文中一共展示了TicketModule._insert_ticket_data方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: process_request
# 需要導入模塊: from trac.ticket.web_ui import TicketModule [as 別名]
# 或者: from trac.ticket.web_ui.TicketModule import _insert_ticket_data [as 別名]
def process_request(self, req):
id = int(req.args.get('id'))
req.perm('ticket', id).require('TICKET_ADMIN')
ticket = Ticket(self.env, id)
action = req.args['action']
cnum = req.args.get('cnum')
if req.method == 'POST':
if 'cancel' in req.args:
href = req.href.ticket(id)
if action == 'delete-comment':
href += '#comment:%s' % cnum
req.redirect(href)
if action == 'delete':
ticket.delete()
add_notice(req, _('The ticket #%(id)s has been deleted.',
id=ticket.id))
req.redirect(req.href())
elif action == 'delete-comment':
cdate = from_utimestamp(long(req.args.get('cdate')))
ticket.delete_change(cdate=cdate)
add_notice(req, _('The ticket comment %(num)s on ticket '
'#%(id)s has been deleted.',
num=cnum, id=ticket.id))
req.redirect(req.href.ticket(id))
tm = TicketModule(self.env)
data = tm._prepare_data(req, ticket)
tm._insert_ticket_data(req, ticket, data,
get_reporter_id(req, 'author'), {})
data.update(action=action, cdate=None)
if action == 'delete-comment':
data['cdate'] = req.args.get('cdate')
cdate = from_utimestamp(long(data['cdate']))
for change in data['changes']:
if change.get('date') == cdate:
data['change'] = change
data['cnum'] = change.get('cnum')
break
else:
raise TracError(_('Comment %(num)s not found', num=cnum))
elif action == 'delete':
attachments = Attachment.select(self.env, ticket.realm, ticket.id)
data.update(attachments=list(attachments))
add_stylesheet(req, 'common/css/ticket.css')
return 'ticket_delete.html', data, None